Académique Documents
Professionnel Documents
Culture Documents
Objectives
After completing this lesson, you should be able to do the
following:
List the capabilities of SQL SELECT statements
Execute a basic SELECT statement
1-2
Lesson Agenda
Basic SELECT statement
Arithmetic expressions and NULL values in the SELECT
statement
Column aliases
Use of concatenation operator, literal character strings,
alternative quote operator, and the DISTINCT keyword
DESCRIBE command
1-3
Projection
Selection
Table 1
Table 1
Join
Table 1
1-4
Table 2
Copyright 2007, Oracle. All rights reserved.
1-5
SELECT *
FROM
departments;
1-6
1-7
1-8
SQL*Plus:
Character and Date column headings are left-aligned.
Number column headings are right-aligned.
Default heading display: Uppercase
1-9
Lesson Agenda
Basic SELECT statement
Arithmetic expressions and NULL values in the SELECT
statement
Column Aliases
Use of concatenation operator, literal character strings,
alternative quote operator, and the DISTINCT keyword
DESCRIBE command
1 - 10
Arithmetic Expressions
Create expressions with number and date data by using
arithmetic operators.
Operator
+
Add
Subtract
Multiply
1 - 11
Description
Divide
1 - 12
Operator Precedence
1 - 13
1 - 14
1 - 15
Lesson Agenda
Basic SELECT statement
Arithmetic expressions and NULL values in the SELECT
statement
Column aliases
Use of concatenation operator, literal character strings,
alternative quote operator, and the DISTINCT keyword
DESCRIBE command
1 - 16
1 - 17
1 - 18
Lesson Agenda
Basic SELECT Statement
Arithmetic Expressions and NULL values inSELECT
statement
Column Aliases
Use of concatenation operator, literal character strings,
alternative quote operator, and the DISTINCT keyword
DESCRIBE command
1 - 19
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;
1 - 20
1 - 21
1 - 22
1 - 23
Duplicate Rows
The default display of queries is all rows, including duplicate
rows.
SELECT department_id
FROM
employees;
1 - 24
Lesson Agenda
Basic SELECT statement
Arithmetic expressions and NULL values in the SELECT
statement
Column aliases
Use of concatenation operator, literal character strings,
alternative quote operator, and the DISTINCT keyword
DESCRIBE command
1 - 25
1 - 26
DESCRIBE employees
1 - 27
Summary
In this lesson, you should have learned how to:
Write a SELECT statement that:
Returns all rows and columns from a table
Returns specified columns from a table
Uses column aliases to display more descriptive column
headings
1 - 28
Practice 1: Overview
This practice covers the following topics:
Selecting all data from different tables
Describing the structure of tables
Performing arithmetic calculations and specifying column
names
1 - 29
1 - 30
1 - 31
1 - 32
1 - 33
1 - 34