BDI LProyeccion
BDI LProyeccion
BDI LProyeccion
1-2
Capabilities of SQL SELECT Statements
Projection Selection
Table 1 Table 1
Join
Table 1 Table 2
1-3
Basic SELECT Statement
1-4
Selecting All Columns
SELECT *
FROM departments;
1-5
Selecting Specific Columns
1-6
Writing SQL Statements
1-7
Column Heading Defaults
• SQL*Plus:
– Character and Date column headings are left-
aligned
– Number column headings are right-aligned
– Default heading display: Uppercase
1-8
Arithmetic Expressions
1-9
Using Arithmetic Operators
1-10
Operator Precedence
…
SELECT last_name, salary, 12*(salary+100)
FROM employees;
2
1-11
Defining a Null Value
1-12
Null Values
in Arithmetic Expressions
1-13
Defining a Column Alias
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 case-
sensitive
1-14
Using Column Aliases
1-15
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 last_name||job_id AS "Employees"
FROM employees;
1-16
Literal Character Strings
1-17
Using Literal Character Strings
1-18
Duplicate Rows
…
SELECT DISTINCT department_id
FROM employees; 2
1-19
Summary
1-20
Practice 1: Overview
1-21