Presentation is loading. Please wait.

Presentation is loading. Please wait.

9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two.

Similar presentations


Presentation on theme: "9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two."— Presentation transcript:

1 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two

2 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 2 Topics Limiting rows selected (Where) Sorting selected rows (Order By)

3 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 3 Limiting Rows Selected SELECT [ DISTINCT ] { * | column [alias], … } FROMtable [ WHEREcondition (s) ] ;

4 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 4 Where Clause Can Compare Values in columns Literal values Arithmetic expressions, or Functions

5 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 5 Character Strings & Dates Enclosed in single quotation marks Character values  case sensitive Date values  –format sensitive –Default – DD-MON-YY

6 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 6 Comparison Operators = > >= < <= <> Syntax -- WHERE expr operator value

7 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 7 Examples

8 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 8 Other Comparison Operators BETWEEN … AND …  Between two values (inclusive) IN(list)  Matches any value in list of values LIKE  Match a character pattern IS NULL  Is a null value

9 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 9 LIKE Wildcards %  any sequence of zero or more characters _ (underscore)  any single character ESCAPE Option to match wildcard characters

10 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 10 Logical Operators AND  True if both conditions True OR  True if either condition True NOT  –True if condition False –False if condition True –Null if condition Null

11 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 11 Operator Precedence Rules 1.All comparison operators 2.NOT 3.AND 4.OR Override rules with parenthesis.

12 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 12 ORDER BY Clause Sorts rows –ASC  ascending order (default) –DESC  descending order Must be last clause in Select statement

13 9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 13 Order By Syntax SELECT expression FROM table [WHERE condition(s)] [ORDER BY {column, expr}|ASC|DESC||;


Download ppt "9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two."

Similar presentations


Ads by Google