SlideShare a Scribd company logo
Oracle OCP 考试系列培训
                之
         1Z0-007 Lesson1
                  www.OracleOnLinux.cn




1-1   Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
1
                 Retrieving Data Using
              the SQL SELECT Statement




1-2   Copyright © 2011,   www.OracleOnLinux . Part rights reserved.
                              OracleOnLinux
                              OracleOnLinux.cn
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
       • Differentiate between SQL statements and
           iSQL*Plus commands
            SQL*




1-3         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
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-4       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Capabilities of SQL SELECT Statements


        Projection                               Selection




        Table 1                                  Table 1


                                    Join



        Table 1                                  Table 2

1-5     Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Basic SELECT Statement


      SELECT *|{[DISTINCT] column|expression [alias],...}
      FROM    table;

      •   SELECT identifies the columns to be displayed
      •   FROM identifies the table containing those columns




1-6         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Selecting All Columns


      SELECT *
      FROM   departments;




1-7        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Selecting Specific Columns


      SELECT department_id, location_id
      FROM   departments;




1-8        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Writing SQL Statements


      •   SQL statements are not case-sensitive.
      •   SQL statements can be on one or more lines.
      •   Keywords cannot be abbreviated or split
          across lines.
      •   Clauses are usually placed on separate lines.
      •   Indents are used to enhance readability.
      •   In iSQL*Plus, SQL statements can optionally be
              SQL*
          terminated by a semicolon (;). Semicolons are
          required if you execute multiple SQL statements.
      •   In SQL*plus, you are required to end each SQL
             SQL*
          statement with a semicolon (;).


1-9         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Column Heading Defaults


       •   iSQL*Plus:
            SQL*
           – Default heading alignment: Center
           – Default heading display: Uppercase
       •   SQL*Plus:
           SQL*
           – Character and Date column headings are
             Left- aligned
           – Number column headings are right-aligned
           – Default heading display: Uppercase




1-10        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Arithmetic Expressions


       Create expressions with number and date data by
       using arithmetic operators.
                     Operator      Description
                           +       Add
                           -       Subtract
                           *       Multiply
                           /       Divide




1-11         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Using Arithmetic Operators


       SELECT last_name, salary, salary + 300
       FROM   employees;




       …




1-12        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Operator Precedence


       SELECT last_name, salary, 12*salary+100
                                 12*
       FROM   employees;                                                     1



       …
       SELECT last_name, salary, 12*(salary+100)
                                 12*
       FROM   employees;                                                     2



       …


1-13        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Defining a Null Value


       •       A null is a value that is unavailable, unassigned,
               unknown, or inapplicable.
       •       A null is not the same as a zero or a blank space.
           SELECT last_name, job_id, salary, commission_pct
           FROM   employees;




           …

           …


1-14             Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Null Values
                   in Arithmetic Expressions

       Arithmetic expressions containing a null value
       evaluate to null.
        SELECT last_name, 12*salary,12*salary*(1+commission_pct)
                          12*       12* salary*
        FROM   employees;



        …

        …




1-15         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Defining a Column Alias


       A column alias:
        • Renames a column heading
        • Is useful with calculations
        • Immediately follows the column name (There can
           also be the optional AS keyword between the
           column name and alias.)
        • Requires double quotation marks if it contains
           spaces or special characters or if it is case-
           sensitive
        • Can not be used in Where clause



1-16        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Using Column Aliases


       SELECT last_name AS name, commission_pct comm
       FROM   employees;




       …

       SELECT last_name "Name" , salary*12 "Annual Salary"
                                 salary*
       FROM   employees;




       …

1-17       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
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     last_name||job_id AS "Employees"
       FROM       employees;




       …

1-18         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Concatenation Operator



       SELECT    last_name||'''s'||salary
       FROM      employees;



       SELECT    last_name||chr(39)||'s'||salary
       FROM      employees;


       SELECT    ASCII('''')
       FROM      dual;

       SELECT    ASCII('?')
       FROM      dual;


1-19        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Literal Character Strings


       •   A literal is a character, a number, or a date that is
           included in the SELECT statement.
       •   Date and character literal values must be enclosed
           by single quotation marks.
       •   Each character string is output once for each
           row returned.




1-20         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Using Literal Character Strings


       SELECT last_name ||' is a ' ||job_id
              AS "Employee Details"
       FROM   employees;




       …




1-21        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Duplicate Rows


       The default display of queries is all rows, including
       duplicate rows.
       SELECT department_id
       FROM   employees;                                                      1


       …
       SELECT DISTINCT department_id
       FROM   employees;                                                      2


       …

1-22         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
SQL and iSQL*Plus Interaction
                  SQL*


                                SQL statements
                                                               Oracle
                                                               server
       Internet
       browser


               iSQL*Plus
                SQL*                           Query results
               commands

                                Formatted report
         Client




1-23   Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
SQL Statements Versus
                      iSQL*Plus Commands
                       SQL*
       SQL                                   iSQL*Plus
                                              SQL*
        • A language                          • An environment
        • ANSI standard                       • Oracle-proprietary
        • Keyword cannot be                   • Keywords can be
          abbreviated                           abbreviated
        • Statements manipulate               • Commands do not allow
          data and table definitions            manipulation of values in
          in the database                       the database
                                              • Runs on a browser
                                              • Centrally loaded; does not
                                                have to be implemented
                                                on each machine

                 SQL                                      iSQL*Plus
                                                           SQL*
              statements                                  commands


1-24         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Overview of iSQL*Plus
                                   SQL*


       After you log in to iSQL*Plus, you can:
                            SQL*
        • 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-25         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Logging In to iSQL*Plus
                                   SQL*


       From your browser environment:




1-26        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
iSQL*Plus Environment
                     SQL*
                                                                   8        9


                                                   7




1
                                                                            6

       2        3           4        5



1-27       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Displaying Table Structure


       Use the iSQL*Plus DESCRIBE command to display the
                SQL*
       structure of a table:

       DESC[RIBE] tablename




1-28        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Displaying Table Structure


       DESCRIBE employees




1-29        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Interacting with Script Files




       SELECT last_name, hire_date, salary
       FROM   employees;                                   1


                           2



1-30       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Interacting with Script Files




1-31   Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Interacting with Script Files




             1



1-32   Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Interacting with Script Files




       D:TEMPemp_data.sql



       2
                                                                            3


1-33       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
iSQL*Plus History Page
                SQL*

                                                                        3




                                                                   2




  1



1-34   Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
iSQL*Plus History Page
                    SQL*




                                                  3




       4



1-35       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Setting iSQL*Plus Preferences
                      SQL*




                                                                   1




       2
                                                                            3




1-36       Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Setting the Output Location Preference
                                                                      2




                                                            1



1-37     Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
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
       •   Use the iSQL*Plus environment to write, save, and
                    SQL*
           execute SQL statements and iSQL*Plus
                                       SQL*
           commands
       SELECT *|{[DISTINCT] column|expression [alias],...}
       FROM table;



1-38            Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
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
        • Using iSQL*Plus
                   SQL*




1-39         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q1: A SELECT statement can be used to perform these
       three functions:
       1. Choose rows from a table.
       2. Choose columns from a table.
       3. Bring together data that is stored in different tables by
       creating a link between them.
       Which set of keywords describes these capabilities?
       A. difference, projection, join
       B. selection, projection, join
       C. selection, intersection, join
       D. intersection, projection, join
       E. difference, projection, product

1-40         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q2: Evaluate this SQL statement:

       SELECT e.EMPLOYEE_ID,e.LAST_NAME,
       e.DEPARTMENT_ID, d.DEPARTMENT_NAME
       FROM EMPLOYEES e, DEPARTMENTS d
       WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID;

       In the statement, which capabilities of a SELECT statement are
       performed?
       A. selection, projection, join
       B. difference, projection, join
       C. selection, intersection, join
       D. intersection, projection, join
       E. difference, projection, product




1-41          Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q3: Evaluate this SQL statement:

          SELECT ename, sal, 12 *sal+100
                             12*
          FROM emp;

       The SAL column stores the monthly salary of the employee.
       Which change must be made to the above syntax to calculate
       the annual compensation as "monthly salary plus a monthly
       bonus of $100, multiplied by 12"?
       A. No change is required to achieve the desired results.
       B. SELECT ename, sal, 12 *(sal+100) FROM emp;
                                12*
       C. SELECT ename, sal, (12 *sal)+100 FROM emp;
                                (12*
       D. SELECT ename, sal+100, *12 FROM emp;
                           sal+100,*


1-42         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q4: Which SQL statement generates the alias Annual
       Salary for the calculated column SALARY *12?
                                        SALARY*

       A. SELECT ename, salary *12 'Annual Salary'
                        salary*
       FROM employees;
       B. SELECT ename, salary *12 "Annual Salary"
                        salary*
       FROM employees;
       C. SELECT ename, salary *12 AS Annual Salary
                        salary*
       FROM employees;
       D. SELECT ename, salary *12 AS INITCAP("ANNUAL
                        salary*
       SALARY")
       FROM employees

1-43        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q5: The CUSTOMERS table has these columns:

       CUSTOMER_ID     NUMBER(4)      NOT NULL
       CUSTOMER_NAME    VARCHAR2(100) NOT NULL
       CUSTOMER_ADDRESS VARCHAR2(150)
       CUSTOMER_PHONE   VARCHAR2(20)

       You need to produce output that states "Dear Customer
       customer_name, ".
       The customer_name data values come from the
       CUSTOMER_NAME column in the CUSTOMERS table.
       Which statement produces this output?




1-44        Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       A. SELECT dear customer, customer_name,
       FROM customers;
       B. SELECT "Dear Customer", customer_name || ','
       FROM customers;
       C. SELECT 'Dear Customer ' || customer_name ','
       FROM customers;
       D. SELECT 'Dear Customer ' || customer_name || ','
       FROM customers;
       E. SELECT "Dear Customer " || customer_name || ","
       FROM customers;
       F. SELECT 'Dear Customer ' || customer_name || ',' ||
       FROM customers;


1-45         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
Practice 1

       Q6: Which two are attributes of iSQL *Plus? (Choose two.)
                                       iSQL*

       A. iSQL*Plus commands cannot be abbreviated.
           iSQL*
       B. iSQL*Plus commands are accessed from a browser.
           iSQL*
       C. iSQL*Plus commands are used to manipulate data in
           iSQL*
       tables.
       D. iSQL*Plus commands manipulate table definitions in
           iSQL*
       the database.
       E. iSQL*Plus is the Oracle proprietary interface for
           iSQL*
       executing SQL statements.




1-46         Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.

More Related Content

What's hot

SQL SELECT Statement
 SQL SELECT Statement SQL SELECT Statement
SQL SELECT Statement
IslamicUniversityofL
 
Lesson04 学会使用分组函数
Lesson04 学会使用分组函数Lesson04 学会使用分组函数
Lesson04 学会使用分组函数
renguzi
 
Les10
Les10Les10
Les09
Les09Les09
Les01
Les01Les01
Les02
Les02Les02
Les02
Akmal Rony
 
Lesson06 使用子查询
Lesson06 使用子查询Lesson06 使用子查询
Lesson06 使用子查询
renguzi
 
Les06
Les06Les06
Les06
Akmal Rony
 
Lesson10
Lesson10Lesson10
Lesson10
renguzi
 
Lesson05 从多表中查询数据
Lesson05 从多表中查询数据Lesson05 从多表中查询数据
Lesson05 从多表中查询数据
renguzi
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
Achmad Solichin
 
Understanding
Understanding Understanding
Understanding
Arun Gupta
 
Android de la A a la Z XML Ulises Gonzalez
Android de la A a la Z  XML Ulises GonzalezAndroid de la A a la Z  XML Ulises Gonzalez
Android de la A a la Z XML Ulises Gonzalez
Android UNAM
 
Les04
Les04Les04
Les04
Akmal Rony
 
Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)
Ivo Andreev
 
Analytical Functions for DWH
Analytical Functions for DWHAnalytical Functions for DWH
Analytical Functions for DWH
Emrah METE
 
EMF-IncQuery 0.7 Presentation for Itemis
EMF-IncQuery 0.7 Presentation for ItemisEMF-IncQuery 0.7 Presentation for Itemis
EMF-IncQuery 0.7 Presentation for Itemis
Istvan Rath
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
IndicThreads
 
Php 5 3-study_guide_v1a
Php 5 3-study_guide_v1aPhp 5 3-study_guide_v1a
Php 5 3-study_guide_v1a
luckysher007
 
Subconsultas
SubconsultasSubconsultas
Subconsultas
Maria
 

What's hot (20)

SQL SELECT Statement
 SQL SELECT Statement SQL SELECT Statement
SQL SELECT Statement
 
Lesson04 学会使用分组函数
Lesson04 学会使用分组函数Lesson04 学会使用分组函数
Lesson04 学会使用分组函数
 
Les10
Les10Les10
Les10
 
Les09
Les09Les09
Les09
 
Les01
Les01Les01
Les01
 
Les02
Les02Les02
Les02
 
Lesson06 使用子查询
Lesson06 使用子查询Lesson06 使用子查询
Lesson06 使用子查询
 
Les06
Les06Les06
Les06
 
Lesson10
Lesson10Lesson10
Lesson10
 
Lesson05 从多表中查询数据
Lesson05 从多表中查询数据Lesson05 从多表中查询数据
Lesson05 从多表中查询数据
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
 
Understanding
Understanding Understanding
Understanding
 
Android de la A a la Z XML Ulises Gonzalez
Android de la A a la Z  XML Ulises GonzalezAndroid de la A a la Z  XML Ulises Gonzalez
Android de la A a la Z XML Ulises Gonzalez
 
Les04
Les04Les04
Les04
 
Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)
 
Analytical Functions for DWH
Analytical Functions for DWHAnalytical Functions for DWH
Analytical Functions for DWH
 
EMF-IncQuery 0.7 Presentation for Itemis
EMF-IncQuery 0.7 Presentation for ItemisEMF-IncQuery 0.7 Presentation for Itemis
EMF-IncQuery 0.7 Presentation for Itemis
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
 
Php 5 3-study_guide_v1a
Php 5 3-study_guide_v1aPhp 5 3-study_guide_v1a
Php 5 3-study_guide_v1a
 
Subconsultas
SubconsultasSubconsultas
Subconsultas
 

Similar to Lesson01 学会使用基本的SQL语句

Les01 Writing BAsic SQL SELECT Statement.ppt
Les01 Writing BAsic SQL SELECT Statement.pptLes01 Writing BAsic SQL SELECT Statement.ppt
Les01 Writing BAsic SQL SELECT Statement.ppt
DrZeeshanBhatti
 
Database Management Systems SQL And DDL language
Database Management Systems SQL And DDL languageDatabase Management Systems SQL And DDL language
Database Management Systems SQL And DDL language
HSibghatUllah
 
SQL, consultas rapidas y sencillas, oracle
SQL, consultas rapidas y sencillas, oracleSQL, consultas rapidas y sencillas, oracle
SQL, consultas rapidas y sencillas, oracle
marycielocartagena73
 
Lesson03 学会使用单行函数
Lesson03 学会使用单行函数Lesson03 学会使用单行函数
Lesson03 学会使用单行函数
renguzi
 
Lesson02 学会使用WHERE、ORDER BY子句
Lesson02 学会使用WHERE、ORDER BY子句Lesson02 学会使用WHERE、ORDER BY子句
Lesson02 学会使用WHERE、ORDER BY子句
renguzi
 
plsql les02
 plsql les02 plsql les02
plsql les02
sasa_eldoby
 
Lesson08
Lesson08Lesson08
Lesson08
renguzi
 
Introduction of Oracle
Introduction of Oracle Introduction of Oracle
Introduction of Oracle
Salman Memon
 
Oracle Baisc Tutorial
Oracle Baisc TutorialOracle Baisc Tutorial
Oracle Baisc Tutorial
bunny0143
 
Lesson09
Lesson09Lesson09
Lesson09
renguzi
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
rehaniltifat
 
SQL.ppt
SQL.pptSQL.ppt
War of the Indices- SQL vs. Oracle
War of the Indices-  SQL vs. OracleWar of the Indices-  SQL vs. Oracle
War of the Indices- SQL vs. Oracle
Kellyn Pot'Vin-Gorman
 
plsql les01
 plsql les01 plsql les01
plsql les01
sasa_eldoby
 
Introduction to Oracle SQL Database Systems.ppt
Introduction to Oracle SQL Database Systems.pptIntroduction to Oracle SQL Database Systems.ppt
Introduction to Oracle SQL Database Systems.ppt
DrZeeshanBhatti
 
Lesson07
Lesson07Lesson07
Lesson07
renguzi
 
Producing Readable Output with iSQL*Plus - Oracle Data Base
Producing Readable Output with iSQL*Plus - Oracle Data BaseProducing Readable Output with iSQL*Plus - Oracle Data Base
Producing Readable Output with iSQL*Plus - Oracle Data Base
Salman Memon
 
plsql Les08
plsql Les08 plsql Les08
plsql Les08
sasa_eldoby
 
Les08
Les08Les08
Les02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.pptLes02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.ppt
DrZeeshanBhatti
 

Similar to Lesson01 学会使用基本的SQL语句 (20)

Les01 Writing BAsic SQL SELECT Statement.ppt
Les01 Writing BAsic SQL SELECT Statement.pptLes01 Writing BAsic SQL SELECT Statement.ppt
Les01 Writing BAsic SQL SELECT Statement.ppt
 
Database Management Systems SQL And DDL language
Database Management Systems SQL And DDL languageDatabase Management Systems SQL And DDL language
Database Management Systems SQL And DDL language
 
SQL, consultas rapidas y sencillas, oracle
SQL, consultas rapidas y sencillas, oracleSQL, consultas rapidas y sencillas, oracle
SQL, consultas rapidas y sencillas, oracle
 
Lesson03 学会使用单行函数
Lesson03 学会使用单行函数Lesson03 学会使用单行函数
Lesson03 学会使用单行函数
 
Lesson02 学会使用WHERE、ORDER BY子句
Lesson02 学会使用WHERE、ORDER BY子句Lesson02 学会使用WHERE、ORDER BY子句
Lesson02 学会使用WHERE、ORDER BY子句
 
plsql les02
 plsql les02 plsql les02
plsql les02
 
Lesson08
Lesson08Lesson08
Lesson08
 
Introduction of Oracle
Introduction of Oracle Introduction of Oracle
Introduction of Oracle
 
Oracle Baisc Tutorial
Oracle Baisc TutorialOracle Baisc Tutorial
Oracle Baisc Tutorial
 
Lesson09
Lesson09Lesson09
Lesson09
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
 
War of the Indices- SQL vs. Oracle
War of the Indices-  SQL vs. OracleWar of the Indices-  SQL vs. Oracle
War of the Indices- SQL vs. Oracle
 
plsql les01
 plsql les01 plsql les01
plsql les01
 
Introduction to Oracle SQL Database Systems.ppt
Introduction to Oracle SQL Database Systems.pptIntroduction to Oracle SQL Database Systems.ppt
Introduction to Oracle SQL Database Systems.ppt
 
Lesson07
Lesson07Lesson07
Lesson07
 
Producing Readable Output with iSQL*Plus - Oracle Data Base
Producing Readable Output with iSQL*Plus - Oracle Data BaseProducing Readable Output with iSQL*Plus - Oracle Data Base
Producing Readable Output with iSQL*Plus - Oracle Data Base
 
plsql Les08
plsql Les08 plsql Les08
plsql Les08
 
Les08
Les08Les08
Les08
 
Les02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.pptLes02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.ppt
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Lesson01 学会使用基本的SQL语句

  • 1. Oracle OCP 考试系列培训 之 1Z0-007 Lesson1 www.OracleOnLinux.cn 1-1 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 2. 1 Retrieving Data Using the SQL SELECT Statement 1-2 Copyright © 2011, www.OracleOnLinux . Part rights reserved. OracleOnLinux OracleOnLinux.cn
  • 3. 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 • Differentiate between SQL statements and iSQL*Plus commands SQL* 1-3 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 4. 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-4 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 5. Capabilities of SQL SELECT Statements Projection Selection Table 1 Table 1 Join Table 1 Table 2 1-5 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 6. Basic SELECT Statement SELECT *|{[DISTINCT] column|expression [alias],...} FROM table; • SELECT identifies the columns to be displayed • FROM identifies the table containing those columns 1-6 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 7. Selecting All Columns SELECT * FROM departments; 1-7 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 8. Selecting Specific Columns SELECT department_id, location_id FROM departments; 1-8 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 9. Writing SQL Statements • SQL statements are not case-sensitive. • SQL statements can be on one or more lines. • Keywords cannot be abbreviated or split across lines. • Clauses are usually placed on separate lines. • Indents are used to enhance readability. • In iSQL*Plus, SQL statements can optionally be SQL* terminated by a semicolon (;). Semicolons are required if you execute multiple SQL statements. • In SQL*plus, you are required to end each SQL SQL* statement with a semicolon (;). 1-9 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 10. Column Heading Defaults • iSQL*Plus: SQL* – Default heading alignment: Center – Default heading display: Uppercase • SQL*Plus: SQL* – Character and Date column headings are Left- aligned – Number column headings are right-aligned – Default heading display: Uppercase 1-10 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 11. Arithmetic Expressions Create expressions with number and date data by using arithmetic operators. Operator Description + Add - Subtract * Multiply / Divide 1-11 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 12. Using Arithmetic Operators SELECT last_name, salary, salary + 300 FROM employees; … 1-12 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 13. Operator Precedence SELECT last_name, salary, 12*salary+100 12* FROM employees; 1 … SELECT last_name, salary, 12*(salary+100) 12* FROM employees; 2 … 1-13 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 14. Defining a Null Value • A null is a value that is unavailable, unassigned, unknown, or inapplicable. • A null is not the same as a zero or a blank space. SELECT last_name, job_id, salary, commission_pct FROM employees; … … 1-14 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 15. Null Values in Arithmetic Expressions Arithmetic expressions containing a null value evaluate to null. SELECT last_name, 12*salary,12*salary*(1+commission_pct) 12* 12* salary* FROM employees; … … 1-15 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 16. Defining a Column Alias A column alias: • Renames a column heading • Is useful with calculations • Immediately follows the column name (There can also be the optional AS keyword between the column name and alias.) • Requires double quotation marks if it contains spaces or special characters or if it is case- sensitive • Can not be used in Where clause 1-16 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 17. Using Column Aliases SELECT last_name AS name, commission_pct comm FROM employees; … SELECT last_name "Name" , salary*12 "Annual Salary" salary* FROM employees; … 1-17 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 18. 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 last_name||job_id AS "Employees" FROM employees; … 1-18 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 19. Concatenation Operator SELECT last_name||'''s'||salary FROM employees; SELECT last_name||chr(39)||'s'||salary FROM employees; SELECT ASCII('''') FROM dual; SELECT ASCII('?') FROM dual; 1-19 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 20. Literal Character Strings • A literal is a character, a number, or a date that is included in the SELECT statement. • Date and character literal values must be enclosed by single quotation marks. • Each character string is output once for each row returned. 1-20 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 21. Using Literal Character Strings SELECT last_name ||' is a ' ||job_id AS "Employee Details" FROM employees; … 1-21 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 22. Duplicate Rows The default display of queries is all rows, including duplicate rows. SELECT department_id FROM employees; 1 … SELECT DISTINCT department_id FROM employees; 2 … 1-22 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 23. SQL and iSQL*Plus Interaction SQL* SQL statements Oracle server Internet browser iSQL*Plus SQL* Query results commands Formatted report Client 1-23 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 24. SQL Statements Versus iSQL*Plus Commands SQL* SQL iSQL*Plus SQL* • A language • An environment • ANSI standard • Oracle-proprietary • Keyword cannot be • Keywords can be abbreviated abbreviated • Statements manipulate • Commands do not allow data and table definitions manipulation of values in in the database the database • Runs on a browser • Centrally loaded; does not have to be implemented on each machine SQL iSQL*Plus SQL* statements commands 1-24 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 25. Overview of iSQL*Plus SQL* After you log in to iSQL*Plus, you can: SQL* • 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-25 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 26. Logging In to iSQL*Plus SQL* From your browser environment: 1-26 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 27. iSQL*Plus Environment SQL* 8 9 7 1 6 2 3 4 5 1-27 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 28. Displaying Table Structure Use the iSQL*Plus DESCRIBE command to display the SQL* structure of a table: DESC[RIBE] tablename 1-28 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 29. Displaying Table Structure DESCRIBE employees 1-29 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 30. Interacting with Script Files SELECT last_name, hire_date, salary FROM employees; 1 2 1-30 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 31. Interacting with Script Files 1-31 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 32. Interacting with Script Files 1 1-32 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 33. Interacting with Script Files D:TEMPemp_data.sql 2 3 1-33 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 34. iSQL*Plus History Page SQL* 3 2 1 1-34 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 35. iSQL*Plus History Page SQL* 3 4 1-35 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 36. Setting iSQL*Plus Preferences SQL* 1 2 3 1-36 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 37. Setting the Output Location Preference 2 1 1-37 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 38. 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 • Use the iSQL*Plus environment to write, save, and SQL* execute SQL statements and iSQL*Plus SQL* commands SELECT *|{[DISTINCT] column|expression [alias],...} FROM table; 1-38 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 39. 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 • Using iSQL*Plus SQL* 1-39 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 40. Practice 1 Q1: A SELECT statement can be used to perform these three functions: 1. Choose rows from a table. 2. Choose columns from a table. 3. Bring together data that is stored in different tables by creating a link between them. Which set of keywords describes these capabilities? A. difference, projection, join B. selection, projection, join C. selection, intersection, join D. intersection, projection, join E. difference, projection, product 1-40 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 41. Practice 1 Q2: Evaluate this SQL statement: SELECT e.EMPLOYEE_ID,e.LAST_NAME, e.DEPARTMENT_ID, d.DEPARTMENT_NAME FROM EMPLOYEES e, DEPARTMENTS d WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID; In the statement, which capabilities of a SELECT statement are performed? A. selection, projection, join B. difference, projection, join C. selection, intersection, join D. intersection, projection, join E. difference, projection, product 1-41 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 42. Practice 1 Q3: Evaluate this SQL statement: SELECT ename, sal, 12 *sal+100 12* FROM emp; The SAL column stores the monthly salary of the employee. Which change must be made to the above syntax to calculate the annual compensation as "monthly salary plus a monthly bonus of $100, multiplied by 12"? A. No change is required to achieve the desired results. B. SELECT ename, sal, 12 *(sal+100) FROM emp; 12* C. SELECT ename, sal, (12 *sal)+100 FROM emp; (12* D. SELECT ename, sal+100, *12 FROM emp; sal+100,* 1-42 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 43. Practice 1 Q4: Which SQL statement generates the alias Annual Salary for the calculated column SALARY *12? SALARY* A. SELECT ename, salary *12 'Annual Salary' salary* FROM employees; B. SELECT ename, salary *12 "Annual Salary" salary* FROM employees; C. SELECT ename, salary *12 AS Annual Salary salary* FROM employees; D. SELECT ename, salary *12 AS INITCAP("ANNUAL salary* SALARY") FROM employees 1-43 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 44. Practice 1 Q5: The CUSTOMERS table has these columns: CUSTOMER_ID NUMBER(4) NOT NULL CUSTOMER_NAME VARCHAR2(100) NOT NULL CUSTOMER_ADDRESS VARCHAR2(150) CUSTOMER_PHONE VARCHAR2(20) You need to produce output that states "Dear Customer customer_name, ". The customer_name data values come from the CUSTOMER_NAME column in the CUSTOMERS table. Which statement produces this output? 1-44 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 45. Practice 1 A. SELECT dear customer, customer_name, FROM customers; B. SELECT "Dear Customer", customer_name || ',' FROM customers; C. SELECT 'Dear Customer ' || customer_name ',' FROM customers; D. SELECT 'Dear Customer ' || customer_name || ',' FROM customers; E. SELECT "Dear Customer " || customer_name || "," FROM customers; F. SELECT 'Dear Customer ' || customer_name || ',' || FROM customers; 1-45 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.
  • 46. Practice 1 Q6: Which two are attributes of iSQL *Plus? (Choose two.) iSQL* A. iSQL*Plus commands cannot be abbreviated. iSQL* B. iSQL*Plus commands are accessed from a browser. iSQL* C. iSQL*Plus commands are used to manipulate data in iSQL* tables. D. iSQL*Plus commands manipulate table definitions in iSQL* the database. E. iSQL*Plus is the Oracle proprietary interface for iSQL* executing SQL statements. 1-46 Copyright © 2011, www.OracleOnLinux.cn . Part rights reserved.