Professional Documents
Culture Documents
Microsoft Power Point - Les01
Microsoft Power Point - Les01
Copyright © 2006, Oracle. All rights reserved. 1-2 Copyright © 2006, Oracle. All rights reserved.
Join
Table 1 Table 2
1-3 Copyright © 2006, Oracle. All rights reserved. 1-4 Copyright © 2006, Oracle. All rights reserved.
Selecting All Columns Selecting Specific Columns
1-5 Copyright © 2006, Oracle. All rights reserved. 1-6 Copyright © 2006, Oracle. All rights reserved.
1-7 Copyright © 2006, Oracle. All rights reserved. 1-8 Copyright © 2006, Oracle. All rights reserved.
Arithmetic Expressions Using Arithmetic Operators
Create expressions with number and date data by using SELECT last_name, salary, salary + 300
arithmetic operators. FROM employees;
Operator Description
+ Add
- Subtract
* Multiply
/ Divide …
1-9 Copyright © 2006, Oracle. All rights reserved. 1 - 10 Copyright © 2006, Oracle. All rights reserved.
… …
1 - 11 Copyright © 2006, Oracle. All rights reserved. 1 - 12 Copyright © 2006, Oracle. All rights reserved.
Null Values Defining a Column Alias
in Arithmetic Expressions
1 - 13 Copyright © 2006, Oracle. All rights reserved. 1 - 14 Copyright © 2006, Oracle. All rights reserved.
… …
1 - 15 Copyright © 2006, Oracle. All rights reserved. 1 - 16 Copyright © 2006, Oracle. All rights reserved.
Literal Character Strings Using Literal Character Strings
1 - 17 Copyright © 2006, Oracle. All rights reserved. 1 - 18 Copyright © 2006, Oracle. All rights reserved.
• Specify your own quotation mark delimiter The default display of queries is all rows, including
• Choose any delimiter duplicate rows.
• Increase readability and usability SELECT department_id
FROM employees; 1
SELECT department_name ||
q'[, it's assigned Manager Id: ]'
|| manager_id
AS "Department and Manager" …
FROM departments;
SELECT DISTINCT department_id
FROM employees; 2
…
…
1 - 19 Copyright © 2006, Oracle. All rights reserved. 1 - 20 Copyright © 2006, Oracle. All rights reserved.
SQL and iSQL*Plus Interaction SQL Statements Versus
iSQL*Plus Commands
SQL iSQL*Plus
• A language • An environment
SQL statements
Oracle • ANSI standard • Oracle-proprietary
server
• Keyword cannot be • Keywords can be
Internet abbreviated abbreviated
browser
• Statements manipulate • Commands do not allow
data and table definitions manipulation of values in
in the database the database
iSQL*Plus Query results
commands • Runs on a browser
• Centrally loaded; does not
Formatted report have to be implemented
Client on each machine
SQL iSQL*Plus
statements commands
1 - 21 Copyright © 2006, Oracle. All rights reserved. 1 - 22 Copyright © 2006, Oracle. All rights reserved.
After you log in to iSQL*Plus, you can: From your browser environment:
• Describe table structures
• Enter, execute, and edit SQL statements
• Save or append SQL statements to files
• Execute or edit statements that are stored in saved
script files
1 - 23 Copyright © 2006, Oracle. All rights reserved. 1 - 24 Copyright © 2006, Oracle. All rights reserved.
iSQL*Plus Environment Displaying Table Structure
8 9
DESC[RIBE] tablename
1
6
2 3 4 5
1 - 25 Copyright © 2006, Oracle. All rights reserved. 1 - 26 Copyright © 2006, Oracle. All rights reserved.
DESCRIBE employees
1 - 27 Copyright © 2006, Oracle. All rights reserved. 1 - 28 Copyright © 2006, Oracle. All rights reserved.
Interacting with Script Files Interacting with Script Files
1 - 29 Copyright © 2006, Oracle. All rights reserved. 1 - 30 Copyright © 2006, Oracle. All rights reserved.
D:\TEMP\emp_data.sql
2 1
3
1 - 31 Copyright © 2006, Oracle. All rights reserved. 1 - 32 Copyright © 2006, Oracle. All rights reserved.
iSQL*Plus History Page Setting iSQL*Plus Preferences
3
1
2
4 3
1 - 33 Copyright © 2006, Oracle. All rights reserved. 1 - 34 Copyright © 2006, Oracle. All rights reserved.
2
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
• Use the iSQL*Plus environment to write, save, and
execute SQL statements and iSQL*Plus commands
1 - 35 Copyright © 2006, Oracle. All rights reserved. 1 - 36 Copyright © 2006, Oracle. All rights reserved.
Practice 1: Overview
1 - 37 Copyright © 2006, Oracle. All rights reserved. 1 - 38 Copyright © 2006, Oracle. All rights reserved.
1 - 39 Copyright © 2006, Oracle. All rights reserved. 1 - 40 Copyright © 2006, Oracle. All rights reserved.
1 - 41 Copyright © 2006, Oracle. All rights reserved. 1 - 42 Copyright © 2006, Oracle. All rights reserved.