我正在使用postgreSQL查询。例如,我想从SQL查询中提取所有信息
sql = " select d_year, s_nation, p_category, sum(lo_revenue - lo_supplycost) as profit from DATES, CUSTOMER, SUPPLIER, PART, LINEORDER where lo_custkey = c_custkey and lo_suppkey = s_suppkey and lo_partkey = p_partkey and lo_orderdate = d_datekey and c_region = 'AFRICA' and s_region = 'AFRICA' and (d_year = 1996 or d_year = 1997) and (p_mfgr = 'MFGR#2' or p_mfgr = 'MFGR#4') group by d_year, s_nation, p_category order by d_year, s_nation, p_category "
我想得到所有相关的表、所有选择谓词和所有连接谓词、按部分分组和按部分排序。你知道吗
我使用了sqlparse
,找到了一种只获取相关表的方法。
有没有关于如何提取这些信息的例子?你知道吗
该算法给出了每个关键字之间的精确元素。我用了
sqlparse
相关问题 更多 >
编程相关推荐