Writing Basic SQL SELECT Statements
Writing Basic SQL SELECT Statements
Writing Basic
SQL SELECT Statements
Projection Selection
Table 1 Table 1
Join
Table 1 Table 2
SELECT
SELECT *|{[DISTINCT]
*|{[DISTINCT] column|expression
column|expression [alias],...}
[alias],...}
FROM
FROM table;
table;
SELECT *
FROM departments;
• iSQL*Plus:
– Default heading justification: Center
– Default heading display: Uppercase
• SQL*Plus:
– Character and Date column headings are left-
justified
– Number column headings are right-justified
– Default heading display: Uppercase
Operator Description
+ Add
- Subtract
* Multiply
/ Divide
_
// ++ _
**
• Multiplication and division take priority over
addition and subtraction.
• Operators of the same priority are evaluated from
left to right.
• Parentheses are used to force prioritized
evaluation and to clarify statements.
A column alias:
• Renames a column heading
• Is useful with calculations
• Immediately follows the column name - there can
also be the optional AS keyword between the
column name and alias
• Requires double quotation marks if it contains
spaces or special characters or is case sensitive
A concatenation operator:
• Concatenates columns or character strings to
other columns
• Is represented by two vertical bars (||)
• Creates a resultant column that is a character
expression
SQL statements
iSQL*Plus Oracle
Internet server
Browser
Formatted report
Client
1 7
2 3 4 5
DESC[RIBE]
DESC[RIBE] tablename
tablename
DESCRIBE
DESCRIBE employees
employees
D:\temp\emp_sql.htm
DESCRIBE employees
SELECT first_name, last_name, job_id 1
FROM employees;
3 2