Tuesday, November 26, 2013

Basic SELECT Statement

SELECT *|{[DISTINCT] column|expression [alias],...}
FROM    table;

SELECT identifies the columns to be displayed
•FROM identifies the table containing those columns

To SELECT all columns from a particular table, the following command is used.


SELECT * FROM   departments;

To SELECT specific columns, column names should be mentioned as below.


SELECT department_id, location_id FROM   departments;

SQL Statements

•SQL statements are not case-sensitive.
•SQL statements can be on one or more lines.
•Keywords cannot be abbreviated or split across lines.
•Clauses are usually placed on separate lines.
•Indents are used to enhance readability.
•In iSQL*Plus, SQL statements can optionally be terminated by a semicolon (;).
Semicolons are required if you execute multiple SQL statements.
•In SQL*plus, you are required to end each SQL statement with a semicolon (;).



Reference : Oracle docs



No comments:

Post a Comment