Basic SELECT Statement
Select *| {[DISTINCT] column|expression [alias],....} From table;Select identifies the columns to be displayed.
From identifies the table containing those columns.
Select * From departments;
Writing SQL Statements
# SQL statements are not case-sensitive.
# SQL statements can be entered on one or more lines.
# Keywords cannot be abbreviated or split acros lines.
# Clauses are usually placed on separete lines.
# Indents are used to enhance readability.
# In SQL Developer, SQL statements can optionally be terminated by a semicolon(;).
# Semicolons are required when you execute multiple SQL statements.
# In SQL*Plus, you are required to end each SQL statement with a semicolon(;)
select department_id from departments; select last_name, salary, salary + 300 from employees; select last_name, salary, 12*salary+100 from employees; select last_name, salary, 12*(salary+100) from employees; select last_name, job_id, salary, commission_pct from employees; select last_name, 12*salary*commission_pct from employees; select last_name AS name, commission_pct com from employees; select last_name "name", salary*12 "annual salary" from employees; select last_name||job_id as "employees" from employees; select last_name || ' is a '|| job_id as "employee details" from employees; select department_name || q'[ Department's Manager ID:]' || manager_id as "department and manager" from departments; select department_id from employees; select distinct department_id from employees; describe employees; SELECT first_name, last_name, job_id, salary AS yearly FROM employees;
No comments:
Post a Comment