Skip to content
No results
We use cookies to ensure that we give you the best experience on our website.

# Decoding SQL grammar — select statement

This demo helps you fully take advantage of the general SQL parser to decode SQL grammar of select SQL statement.

Take this SQL for example:

    SELECT e.last_name      AS name,
           e.commission_pct comm,
           e.salary * 12    "Annual Salary"
    FROM   scott.employees AS e
    WHERE  e.salary > 1000
    ORDER  BY
      e.first_name,
      e.last_name;

SQL elements in select statement decoded by this demo:

    Select statement:
    	Select set type: none

    select clause:
    	Columns
    		Fullname:e.last_name
    		Prefix:e	Column:last_name	alias:name
    		Fullname:e.commission_pct
    		Prefix:e	Column:commission_pct	alias:comm
    		Fullname:e.salary * 12
    		Prefix:	Column:e.salary * 12	alias:"Annual Salary"

    from clause:
    	scott.employees as e
    	schema: scott
    	object:  employees
    	tablealias: e

    where clause:
    	e.salary > 1000

    order by clause:
    	e.first_name,
    	e.last_name

If Select SQL Statement with UNION, INTERSECT, and EXCEPT set operators, please check this document

Download this demo: C# version, Java version, ANSI C demo