{"id":929,"date":"2011-04-19T04:02:15","date_gmt":"2011-04-19T09:02:15","guid":{"rendered":"http:\/\/www.dpriver.com\/blog\/?page_id=929"},"modified":"2012-09-05T03:48:21","modified_gmt":"2012-09-05T08:48:21","slug":"get-referenced-table-column-in-a-select-list-item","status":"publish","type":"page","link":"https:\/\/www.dpriver.com\/blog\/list-of-demos-illustrate-how-to-use-general-sql-parser\/get-referenced-table-column-in-a-select-list-item\/","title":{"rendered":"Get referenced table column in a select list item"},"content":{"rendered":"

This simple demo illustrates how to get table and columns involved in a select list item like this:<\/p>\n

    \r\nselect sal.income + sal.bonus * emp.age + 5 as real_sal,\r\n       emp.name as title \r\nfrom employee emp, salary sal \r\nwhere emp.id=sal.eid\r\n<\/pre>\nWhat this demo do is tell you that in select list item:<\/p>\n\r\nsal.income + sal.bonus * emp.age + 5 as real_sal\r\n<\/pre>\ncolumns been referenced are listed below:<\/p>\n\r\nsalary.income\r\nsalary.bonus\r\nemployee.age\r\n<\/pre>\nGeneral SQL Parser can handle this well no matter how complex the select list item is. If combine this demo together with this demo: Visit SQL statement recursively<\/a>, then it’s easy to get information such as which columns (with their respective tables) provide the data of the result set, no matter which set operation (union, minus) they are in, no matter how deeply embedded in select-clause subqueries they are, etc.<\/p>\nDownload demo: Java version<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"This simple demo illustrates how to get table and columns involved in a select list item like this: select sal.income + sal.bonus * emp.age + 5 as real_sal, emp.name as title from employee emp, salary sal where emp.id=sal.eid What this demo do is tell you that in select list item: sal.income + sal.bonus * emp.age + 5 as real_sal columns been referenced are listed below: salary.income salary.bonus employee.age General SQL Parser can handle this well no matter how complex the select list item is. If combine this demo together with this demo: Visit SQL statement recursively, then it’s easy to\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":235,"menu_order":90,"comment_status":"closed","ping_status":"open","template":"gsp_feature_page_tt.php","meta":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nHelp you to make better use of General SQL Parser<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n