Langsung ke konten utama

Section 2 Quiz Oracle Database Programming with SQL

Section 2 Quiz
            (Answer all questions in this section)
1.         Which of the following are true? (Choose Two)          Mark for Review
(1) Points
                                    (Choose all correct answers)   
            Character values are not case-sensitive
            Date values are format-sensitive (*)
            Date values are enclosed in single quotation marks (*)
            Character strings are enclosed in double quotation marks

2.         Which of the following would be returned by this SELECT statement:
SELECT last_name, salary
FROM employees
WHERE salary < 3500;

 Mark for Review
(1) Points

LAST_NAME  SALARY
King     5000

LAST_NAME  SALARY
Rajas    3500

LAST_NAME  SALARY
Davies 3100
(*)

All of the above

3.         How can you write "not equal to" in the WHERE-clause?       Mark for Review
(1) Points
            !=
            ^=
            <>
            All of the above (*)

4.         Which query would give the following result?
LAST_NAME  FIRST_NAME DEPARTMENT_ID
King     Steven  90
 Mark for Review
(1) Points

            SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE 'k%';

            SELECT last_name, first_name, department_id
FROM employees
WHERE last_name LIKE 'KING';

            SELECT last_name, first_name, department_id
FROM employees
WHERE last_name = 'King';
(*)

            SELECT last_name, first_name, department_id
FROM employees C
WHERE last_name = 'KING';

5.         Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table?            Mark for Review
(1) Points
            SELECT DISTINCT manager_id, department_id FROM employees;
            SELECT manager_id, DISTINCT department_id FROM employees;
            SELECT manager_id, department_id FROM employees; (*)
            SELECT manager_id, department_id DISTINCT FROM employees;

6.         Where in a SQL statement can you not use arithmetic operators?        Mark for Review
(1) Points
            WHERE
            SELECT
            NONE
            FROM (*)

7.         Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10?  Mark for Review
(1) Points
            WHERE (*)
            FROM
            SELECT
            IS

8.         The concatenation operator ... Mark for Review
(1) Points
            Brings together columns or character strings into other columns
            Creates a resultant column that is a character expression
            Is represented by two vertical bars ( || )
            All of the above (*)

9.         You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use?         Mark for Review
(1) Points
            LIKE
            BETWEEN...AND... (*)
            IN
            IS NULL

10.       Which comparison condition would you use to select rows that match a character pattern?    Mark for Review
(1) Points
            LIKE (*)
            IN
            ALMOST
            SIMILAR

11.       Which of the following WHERE clauses would not select the number 10?     Mark for Review
(1) Points

            WHERE hours <= 10
            WHERE hours IN (8,9,10)
            WHERE hours <>10 (*)
            WHERE hours BETWEEN 10 AND 20

12.       When using the "LIKE" operator, the % and _ symbols can be used to do a pattern-matching, wild card search. True or False?  Mark for Review
(1) Points
            True (*)
            False

13.       Which of the following are examples of comparison operators used in the WHERE clause?  Mark for Review
(1) Points
            =, >, <, <=, >=, <>
            between ___ and ___
            in (..,..,.. )
            like
            is null
            All of the above (*)

14.       If you write queries using the BETWEEN operator, it does not matter in what order you enter the values, i.e. BETWEEN low value AND high value will give the same result as BETWEEN high value and low value. True or False?  Mark for Review
(1) Points
            True
            False (*)

15.       The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)

You are writing a SELECT statement to retrieve the names of employees that have an email address.

SELECT last_name||', '||first_name "Employee Name"
FROM employees;

Which WHERE clause should you use to complete this statement?

 Mark for Review
(1) Points
            WHERE email != NULL;
            WHERE email IS NOT NULL; (*)
            WHERE email = NULL;
            WHERE email IS NULL;

1.         You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values?      Mark for Review
(1) Points
            BETWEEN..AND..
            !=
            =
            IN (*)

2.         You want to retrieve a list of customers whose last names begin with the letters 'Fr' . Which keyword should you include in the WHERE clause of your SELECT statement to achieve the desired result?  Mark for Review
(1) Points
            IN
            BETWEEN
            AND
            LIKE (*)

3.         Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id IN(10, 20, 30)
AND salary > 20000;

Which values would cause the logical condition to return TRUE?

 Mark for Review
(1) Points
            DEPARTMENT_ID = 20 and SALARY = 20000
            DEPARTMENT_ID = 10 and SALARY = 20000
            DEPARTMENT_ID = 10 and SALARY = 20001 (*)
            DEPARTMENT_ID = null and SALARY = 20001

4.         How can you write "not equal to" in the WHERE-clause?       Mark for Review
(1) Points
            !=
            ^=
            <>
            All of the above (*)

5.         Which of the following are true? (Choose Two)          Mark for Review
(1) Points
                                    (Choose all correct answers)   
            Date values are enclosed in single quotation marks (*)
            Character strings are enclosed in double quotation marks
            Date values are format-sensitive (*)
            Character values are not case-sensitive

6.         If you write queries using the BETWEEN operator, it does not matter in what order you enter the values, i.e. BETWEEN low value AND high value will give the same result as BETWEEN high value and low value. True or False?  Mark for Review
(1) Points
            True
            False (*)

7.         The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)

You are writing a SELECT statement to retrieve the names of employees that have an email address.

SELECT last_name||', '||first_name "Employee Name"
FROM employees;

Which WHERE clause should you use to complete this statement?

 Mark for Review
(1) Points
            WHERE email IS NOT NULL; (*)
            WHERE email IS NULL;
            WHERE email = NULL;
            WHERE email != NULL;

8.         When using the "LIKE" operator, the % and _ symbols can be used to do a pattern-matching, wild card search. True or False?  Mark for Review
(1) Points
            True (*)
            False

9.         Which of the following WHERE clauses would not select the number 10?     Mark for Review
(1) Points
            WHERE hours <= 10
            WHERE hours <>10 (*)
            WHERE hours BETWEEN 10 AND 20
            WHERE hours IN (8,9,10)

10.       Which two statements would select salaries that are greater than or equal to 2500 and less than or equal to 3500? (Choose two)    Mark for Review
(1) Points
                                    (Choose all correct answers)   
            WHERE salary BETWEEN 3500 AND 2500
            WHERE salary BETWEEN 2500 AND 3500 (*)
            WHERE salary <=2500 AND salary >= 3500
            WHERE salary >= 2500 AND salary <= 3500 (*)

11.       You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use?         Mark for Review
(1) Points
            "=>"
            !=
            >
            >= (*)

12.       The concatenation operator ... Mark for Review
(1) Points
            Brings together columns or character strings into other columns
            Creates a resultant column that is a character expression
            Is represented by two vertical bars ( || )
            All of the above (*)

13.       You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use?         Mark for Review
(1) Points
            BETWEEN...AND... (*)
            IN
            IS NULL
            LIKE

14.       You need to display only unique combinations of the LAST_NAME and MANAGER_ID columns in the EMPLOYEES table. Which keyword should you include in the SELECT clause?       Mark for Review
(1) Points
            DISTINCTROW
            ONLY
            UNIQUEONE
            DISTINCT (*)

15.       You need to display employees whose salary is in the range of 10000 through 25000 for employees in department 50 . What does the WHERE clause look like?       Mark for Review
(1) Points
            WHERE department_id < 50
AND salary BETWEEN 10000 AND 25000

            WHERE department_id = 50
AND salary BETWEEN 25001 AND 10001

            WHERE department_id = 50
AND salary BETWEEN 10000 AND 25000
(*)

            WHERE department_id > 50

AND salary BETWEEN 10000 AND 25000 

Komentar

  1. You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which operator should you use?
    AND
    |
    +
    || (*)

    The Concatenation Operator does which of the following?
    Links two or more columns or literals to form a single output column (*)
    Is represented by the asterisk (*) symbol
    Separates columns.
    Links rows of data together inside the database.

    Which operator is used to combine columns of character strings to other columns?
    || (*)
    /
    +
    *

    BalasHapus
  2. You need to display all the rows in the EMPLOYEES table that contain a null value in the DEPARTMENT_ID column. Which comparison operator should you use?
    ISNULL
    NULL!
    IS NULL (*)
    "= NULL"

    BalasHapus
  3. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"?
    SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees;
    SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*)
    SELECT last_name||","|| job_id "Employee and Title" FROM employees;
    SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;

    BalasHapus
  4. The following is a valid SQL SELECT statement. True or False?
    SELECT first_name || ' ' || last_name alias AS Employee_Name
    FROM employees:

    True
    False (*)

    BalasHapus
  5. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option?
    &
    ^
    %
    \ (*)

    BalasHapus
  6. Which comparison operator searches for a specified character pattern?
    IN
    BETWEEN...AND...
    LIKE (*)
    IS NULL

    BalasHapus
  7. When using the LIKE condition, which symbol represents any sequence of characters of any length--zero, one, or more characters?
    #
    % (*)
    &
    _

    BalasHapus
  8. Which of the following elements cannot be included in a WHERE clause?
    A column alias (*)
    A constant
    A comparison condition
    A column name

    BalasHapus
  9. You to need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values?
    BETWEEN..AND..
    IN (*)
    !=
    =

    BalasHapus
  10. Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table?
    SELECT DISTINCT manager_id, department_id FROM employees;
    SELECT manager_id, department_id FROM employees; (*)
    SELECT manager_id, department_id DISTINCT FROM employees;
    SELECT manager_id, DISTINCT department_id FROM employees;

    BalasHapus
  11. You want to retrieve a list of customers whose last names begin with the letters 'Fr' . Which symbol should you include in the WHERE clause of your SELECT statement to achieve the desired result?
    ~
    *
    % (*)
    #

    BalasHapus
  12. If the EMPLOYEES table has the following columns, and you want to write a SELECT statement to return the employee last name and department number for employee number 176, which of the following SQL statements should you use?
    Name Type Length
    EMPLOYEE_ID NUMBER 22
    FIRST_NAME VARCHAR2 20
    LAST_NAME VARCHAR2 25
    EMAIL VARCHAR2 25
    PHONE_NUMBER VARCHAR2 20
    SALARY NUMBER 22
    COMMISSION_PCT NUMBER 22
    MANAGER_ID NUMBER 22
    DEPARTMENT_ID NUMBER 22
    SELECT last_name, department_id
    FROM employees
    WHERE employee_id equals 176;
    SELECT last_name, employee_id
    FROM employees
    WHERE employee_id equals 176;
    SELECT last_name, department_id
    FROM employees
    WHERE employee_id = 176; (*)
    SELECT first_name, employee_id
    FROM employees
    WHERE employee_id = 176;

    BalasHapus

Posting Komentar

Postingan populer dari blog ini

Section 6 Quiz Oracle Database Programming with SQL

Section 6 Quiz             (Answer all questions in this section)                                                             1.         Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee ï¾’ s possible minimum and maximum salaries based on their job title? EMPLOYEES Table: Name   Null?    Type EMPLOYEE_ID          NOT NULL     NUMBER (6) FIRST_NAME             VARCHAR2 (20) LAST_NAME  NOT NULL     VARCHAR2 (25) EMAIL NOT NULL     VARCHAR2 (25) PHONE_NUMBER                  VARCHAR2 (20) HIRE_DATE   NOT NULL     DATE JOB_ID           NOT NULL     VARCHAR2 (10) SALARY                     NUMBER (8,2) COMMISSION_PCT                NUMBER (2,2) MANAGER_ID                       NUMBER (6) DEPARTMENT_ID                 NUMBER (4) JOBS Table: Name   Null?    Type JOB_ID           NOT NULL     VARCHAR2 (10) JOB_TITLE     NOT NULL     VARCHAR2 (35) MIN_SALARY                      

Section 10 Quiz Database Programming With SQL

Section 10 Quiz             (Answer all questions in this section) 1.         A multiple-row operator expects how many values?   Mark for Review (1) Points             One or more (*)             Only one             Two or more             None 2.         The salary column of the f_staffs table contains the following values: 4000 5050 6000 11000 23000 Which of the following statements will return the last_name and first_name of those employees who earn more than 5000?  Mark for Review (1) Points             SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT last_name, first_name FROM f_staffs WHERE salary <5000 o:p="">             SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary < 5000);             SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT salary FROM f_staffs WHERE salary > 5000); (*)             SELEC

Section 6 Quiz Database Design Oracle

Section 6 Quiz             (Answer all questions in this section) 1.         Examine the following Entity and decide which rule of Normal Form is being violated: ENTITY: CLIENT ATTRIBUTES:     # CLIENT ID     FIRST NAME     LAST NAME     STREET     CITY     ZIP CODE  Mark for Review (1) Points             1st Normal Form.             2nd Normal Form.             3rd Normal Form.             None of the above, the entity is fully normalised. (*) 2.         A transitive dependency exists when any attribute in an entity is dependent on any other non-UID attribute in that entity.            Mark for Review (1) Points             True (*)             False 3.         When any attribute in an entity is dependent on any other non-UID attribute in that entity, this is known as:        Mark for Review (1) Points             Functional dependency             Dependency             Transitive dependency (*)             Non-dependency