Les02 .pdf
File information
Original filename: Les02.pdf
Title: PowerPoint Presentation
Author: Oracle
This PDF 1.5 document has been generated by Microsoft® PowerPoint® 2013, and has been sent on pdf-archive.com on 05/11/2015 at 22:55, from IP address 41.176.x.x.
The current document download page has been viewed 669 times.
File size: 407 KB (27 pages).
Privacy: public file
Share on social networks
Link to this file download page
Document preview
Restricting and Sorting Data
Copyright © 2004, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to do
the following:
• Limit the rows that are retrieved by a query
• Sort the rows that are retrieved by a query
• Use ampersand substitution in iSQL*Plus to
restrict and sort output at run time
2-2
Copyright © 2004, Oracle. All rights reserved.
Limiting Rows Using a Selection
EMPLOYEES
…
“retrieve all
employees in
department 90”
2-3
Copyright © 2004, Oracle. All rights reserved.
Limiting the Rows That Are Selected
•
Restrict the rows that are returned by using the
WHERE clause:
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM
table
[WHERE condition(s)];
•
2-4
The WHERE clause follows the FROM clause.
Copyright © 2004, Oracle. All rights reserved.
Using the WHERE Clause
SELECT employee_id, last_name, job_id, department_id
FROM
employees
WHERE department_id = 90 ;
2-5
Copyright © 2004, Oracle. All rights reserved.
Character Strings and Dates
•
•
•
Character strings and date values are enclosed by
single quotation marks.
Character values are case-sensitive, and date
values are format-sensitive.
The default date format is DD-MON-RR.
SELECT last_name, job_id, department_id
FROM
employees
WHERE last_name = 'Whalen' ;
2-6
Copyright © 2004, Oracle. All rights reserved.
Comparison Conditions
Operator
=
Equal to
>
Greater than
>=
2-7
Meaning
Greater than or equal to
<
Less than
<=
Less than or equal to
<>
Not equal to
BETWEEN
...AND...
Between two values
(inclusive)
IN(set)
Match any of a list of values
LIKE
Match a character pattern
IS NULL
Is a null value
Copyright © 2004, Oracle. All rights reserved.
Using Comparison Conditions
SELECT last_name, salary
FROM
employees
WHERE salary <= 3000 ;
2-8
Copyright © 2004, Oracle. All rights reserved.
Using the BETWEEN Condition
Use the BETWEEN condition to display rows based on a
range of values:
SELECT last_name, salary
FROM
employees
WHERE salary BETWEEN 2500 AND 3500 ;
Lower limit
2-9
Upper limit
Copyright © 2004, Oracle. All rights reserved.
Link to this page
Permanent link
Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..
Short link
Use the short link to share your document on Twitter or by text message (SMS)
HTML Code
Copy the following HTML code to share your document on a Website or Blog