Les01 - Retrieving Data Using The SQL SELECT Statement
Les01 - Retrieving Data Using The SQL SELECT Statement
Objectives
Projection
Selection
Table 1
Table 1
Join
Table 1
Table 2
Copyright 2004, Oracle. All rights reserved.
SELECT *
FROM
departments;
iSQL*Plus:
Default heading alignment: Center
Default heading display: Uppercase
SQL*Plus:
Character and Date column headings are leftaligned
Number column headings are right-aligned
Default heading display: Uppercase
Arithmetic Expressions
Description
Add
Subtract
Multiply
Divide
Operator Precedence
Null Values
in Arithmetic Expressions
Arithmetic expressions containing a null value
evaluate to null.
SELECT last_name, 12*salary*commission_pct
FROM
employees;
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 if it is casesensitive
Concatenation Operator
A concatenation operator:
Links columns or character strings to other
columns
Is represented by two vertical bars (||)
Creates a resultant column that is a character
expression
SELECT
FROM
last_name||job_id AS "Employees"
employees;
SELECT department_name ||
q'[, it's assigned Manager Id: ]'
|| manager_id
AS "Department and Manager"
FROM departments;
Duplicate Rows