Description :
A SELECT statement retrieves information from the database.
Syntax:
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table;
SELECT : is a list of one or more columns.
* : selects all columns.
DISTINCT : suppresses duplicates.
column|expression : selects the named column or the expression.
alias : gives the selected
columns different headings.
FROM
table : specifies
the table containing the columns.
Examples:
SELECT *
FROM departments;
The select statement display all the columns and all rows of the DEPARTMENTS
table.
The department table contains four columns: DEPARTMENT_ID,DEPARTMENT_NAME,MANAGER_ID,
and LOCATION_ID.
The table contains eight rows, one for each department.
SELECT department_id, location_id
FROM departments;
You can use the SELECT statement to display specific columns of the table by specifying the
column names, separated by commas.
The select statement display all the department numbers and location numbers from the DEPARTMENTS
table.
SELECT
last_name
as "Name" , salary*12 "Annual Salary"
FROM employees;
SELECT DISTINCT department_id
FROM employees;
No comments :
Post a Comment