You can use the Select and Select Distinct clauses to run queries to analyze data in a table.
For example, the following query returns all data in table1:
SELECT * from table 1
The following query returns distinct data values from the columns col 1 and col 2 in table 2.
SELECT DISTINCT col 1, col 2 from table 2
You can use joins, aggregate functions, the Where clause with options, and other clauses with the Select and Select Distinct clauses.
You can run queries with table names and column names that contain spaces or dashes. You must enter the table name or column name within '\"'. Use the following syntax:
SELECT \"<column-name>\" from \"<table name>\"
You cannot use other special characters in a query.
You can use only English characters, the underscore ('_'), and numeric characters in a query.
Alias
You can use aliases when you run a query with the Select and Select Distinct clauses.
For example:
SELECT <alias_name>.<column_name> FROM <table_name> <alias_name>
SELECT <column_name> as <alias_name> from <table_name>
SELECT e.dept_id FROM Employee e
SELECT emp_name as name from TDWEMP
SELECT e.dept_id, e.name FROM Employee e WHERE e.name like 'J%'