A query is a SELECT statement that retrieves data from one or more tables or views.
The syntax of an SQL statement typically takes the following form:
SELECT select_list FROM table_list;
In the syntax,
select_listindicates the columns to be retrieved fromtable_list. However, it can also include functions, character constants, computed variables, and so on.table_listspecifies the tables or views that contain the data to be selected.
The preceding example is a simple SQL query statement. table_list can also be a subquery. You can add a WHERE clause to filter results returned by the query.
Note that in an Oracle tenant, table_list can be replaced with a DUAL table, which is a dummy table. In this case, select_list does not specify a specific column. Instead, it is a constant or variable. See the following example SQL statement:
$obclient -h10.0.0.0 -utpcc@t_oracle0_91#obdoc -P2883 -p****** tpcc
obclient> select 'Medium', 6*6 from dual;
+---------+-----+
| 'Medium'| 6*6 |
+---------+-----+
| Medium | 36 |
+---------+-----+
1 row in set
For more information about how to use query statements, see SELECT.