1 / 20

Chapter 2 Basic SQL SELECT Statements

Chapter 2 Basic SQL SELECT Statements. Chapter Objectives. Distinguish between an RDBMS and an ORDBMS Identify keywords, mandatory clauses, and optional clauses in a SELECT statement Select and view all columns of a table Select and view one column of a table. Chapter Objectives.

roana
Download Presentation

Chapter 2 Basic SQL SELECT Statements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2Basic SQL SELECT Statements Oracle9i: SQL

  2. Chapter Objectives • Distinguish between an RDBMS and an ORDBMS • Identify keywords, mandatory clauses, and optional clauses in a SELECT statement • Select and view all columns of a table • Select and view one column of a table Oracle9i: SQL

  3. Chapter Objectives • Display multiple columns of a table • Use a column alias to clarify the contents of a particular column • Perform basic arithmetic operations in the SELECT clause Oracle9i: SQL

  4. Chapter Objectives • Remove duplicate lists, using either the DISTINCT or UNIQUE keyword • Combine fields, literals, and other data • Format output Oracle9i: SQL

  5. Relational Database Management System (RDBMS) An RDBMS is the software program used to create the database and it allows you to enter, manipulate, and retrieve data Oracle9i: SQL

  6. Object Relational Database Management System (ORDBMS) Same as an RDBMS except it can be used to reference objects such as maps and object fields Oracle9i: SQL

  7. SELECT Statement Syntax • SELECT statements are used to retrieve data from the database • Syntax gives the basic structure, or rules, for a command Oracle9i: SQL

  8. SELECT Statement Syntax Optional clauses and keywords are shown in brackets Oracle9i: SQL

  9. SELECT Statement Syntax • SELECT and FROM clauses are required • SELECT clause identifies column(s) • FROM clause identifies table(s) • Each clause begins with a keyword Oracle9i: SQL

  10. Selecting All Data in a Table Substitute an asterisk for the column names in a SELECT clause Oracle9i: SQL

  11. Selecting One Column from a Table Enter column name in SELECT clause Oracle9i: SQL

  12. Selecting Multiple Columns from a Table Separate column names with a comma Oracle9i: SQL

  13. Operations Within the SELECT Statement • Column alias can be used for column headings • Perform arithmetic operations • Suppress duplicates • Concatenate data Oracle9i: SQL

  14. Column Alias • List after column heading • AS keyword is optional • Enclose in double quotation marks: • If it contains blank space(s) • If it contains special symbol(s) • To retain case Oracle9i: SQL

  15. Column Alias Example Oracle9i: SQL

  16. Arithmetic Operations • Executed left to right • Multiplication and division are solved first • Addition and subtraction are solved last • Override order with parentheses Oracle9i: SQL

  17. Example Arithmetic Operation with Column Alias Oracle9i: SQL

  18. Suppressing Duplicates Enter DISTINCT or UNIQUE after SELECT keyword Oracle9i: SQL

  19. Concatenation • Can combine data with string literal • Use concatenation operator, || • Allows use of column alias Oracle9i: SQL

  20. Concatenation Example Oracle9i: SQL

More Related