Name: 
 

SQL



Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

1. 

SQL numeric data format is/are
a.
number(L,D).
b.
Integer.
c.
Smallint.
d.
Decimal (L,D).
e.
all of the above.
 

2. 

SQL character data format is/are
a.
Char(L).
b.
Varchar(L).
c.
Alphanumeric.
d.
A & B
e.
B & C
 

3. 

You can define a domain by
a.
giving it a name and a data type.
b.
a data type with a value.
c.
a data type and a default value.
d.
giving it a name, data type, value, and a domain constraint.
e.
giving it a name, data type, default value, and a domain constraint.
 

4. 

Domains can be used when:
a.
the set of possible values is relatively small.
b.
the attribute characteristic is not sufficiently important to justify the creation of a new entity.
c.
the objective is to standardize the data characteristic for an attribute appearing in multiple tables
d.
the attribute characteristic is not sufficiently important to justify the creation of a new one.
e.
all of the above.
 

5. 

The SQL command that lets you insert data into a table, one row at a time, is
a.
insert.
b.
select.
c.
commit.
d.
update.
e.
rollback.
 

6. 

The SQL command that lets you save your work to disk, is
a.
insert.
b.
select.
c.
commit.
d.
update.
e.
rollback.
 

7. 

The SQL command that lets you list the table contents is
a.
insert.
b.
select.
c.
commit.
d.
update.
e.
rollback.
 

8. 

The SQL command that enables you to make changes in the data is
a.
insert.
b.
select.
c.
commit.
d.
update.
e.
rollback.
 

9. 

To list all the contents of a PRODUCT table you would use
a.
LIST * FROM PRODUCT;
b.
SELECT * FROM PRODUCT;
c.
DISPLAY * FROM PRODUCT;
d.
SELECT ALL FROM PRODUCT;
 

10. 

When making corrections you would use the following command
a.
CHANGE PRODUCT
      SET P_INDATE = '01/18/2002'
            WHERE P_CODE = '13-Q2/P2';
b.
ROLLBACK PRODUCT
      SET P_INDATE = '01/18/2002'
            WHERE P_CODE = '13-Q2/P2';
c.
EDIT PRODUCT
      SET P_INDATE = '01/18/2002'
            WHERE P_CODE = '13-Q2/P2';
d.
UPDATE PRODUCT
      SET P_INDATE = '01/18/2002'
            WHERE P_CODE = '13-Q2/P2';
 

11. 

To restore the table contents, the command to be used is
a.
COMMIT;
      RESTORE;
b.
COMMIT;
      BACKUP;
c.
COMMIT;
      ROLLBACK;
d.
      ROLLBACK;
 

12. 

To remove the value 2238/QPD from the product table you must use the following command
a.
DELETE FROM PRODUCT
      WHERE P_CODE = '2238/QPD';
b.
REMOVE FROM PRODUCT
      WHERE P_CODE = '2238/QPD';
c.
ERASE FROM PRODUCT
      WHERE P_CODE = '2238/QPD';
d.
ROLLBACK FROM PRODUCT
      WHERE P_CODE = '2238/QPD';
 

13. 

To select partial table contents you must use the command
a.
SELECT <column(s)>
     FROM <Table name>
          WHERE <item>;
b.
LIST <column(s)>
     FROM <Table name>
          WHERE <Conditions>;
c.
SELECT <column(s)>
     FROM <Table name>
          WHERE <Conditions>;
d.
LIST<column(s)>
     FROM <Table name>
          WHERE <Item>;
 

14. 

To create a query using a mathematical symbol to find a specific code (21344) from the product table you must write it as
a.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <> 21344;
b.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <= 21344;
c.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE = 21344;
d.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE => 21344;
 

15. 

To create a query using a mathematical symbol to find all codes but code (21344) from the product table you must write it as
a.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <> 21344;
b.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <= 21344;
c.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE = 21344;
d.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE => 21344;
 

16. 

To create a query using a mathematical symbol to find all codes that are equal or are less than code (21344) from the product table you must write it as
a.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <> 21344;
b.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE <=21344;
c.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE => 21344;
d.
SELECT P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
        FROM PRODUCT
              WHERE V_CODE = 21344;
 

17. 

To select a character-based attribute ( 1558-QW1) from the product table you would write your query command
a.
SELECT P_CODE, P_DESCRIPT, P_ONHAND, P_MIN, P_PRICE
     FROM PRODUCT
            WHERE P-CODE = '1558-QW1'
b.
SELECT P_CODE, P_DESCRIPT, P_ONHAND, P_MIN, P_PRICE
     FROM PRODUCT
            WHERE P-CODE = "1558-QW1"
c.
SELECT P_CODE, P_DESCRIPT, P_ONHAND, P_MIN, P_PRICE
     FROM PRODUCT
            WHERE P-CODE = (1558-QW1)
d.
SELECT P_CODE, P_DESCRIPT, P_ONHAND, P_MIN, P_PRICE
     FROM PRODUCT
            WHERE P-CODE = {1558-QW1}
 

18. 

In a query command to list all the rows in which the inventory stock dates occur on or after January, 2003 using XDB, OS/2 EE Database Manager, or IBM's main frame DB2, the command will be as follows
a.
SELECT P_DESCRIP, P_HAND, P_MIN, P_PRICE, P_INDATE
            FROM PRODUCT
                  WHERE P_INDICATE >= '01/20/2002'
b.
SELECT P_DESCRIP, P_HAND, P_MIN, P_PRICE, P_INDATE
            FROM PRODUCT
                  WHERE P_INDICATE >= #01/20/2002#
c.
SELECT P_DESCRIP, P_HAND, P_MIN, P_PRICE, P_INDATE
            FROM PRODUCT
                  WHERE P_INDICATE >= '20-JAN-2002'
d.
SELECT P_DESCRIP, P_HAND, P_MIN, P_PRICE, P_INDATE
            FROM PRODUCT
                  WHERE P_INDICATE >= {01-20-2002}
 

19. 

In using columns and column aliases to determine the value of inventory held on hand you write the following command
a.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND/P_PRICE
        FROM PRODUCT;
b.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND=P_PRICE
        FROM PRODUCT;
c.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND*P_PRICE
        FROM PRODUCT;
d.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND-P_PRICE
        FROM PRODUCT;
 

20. 

In using columns and column aliases to determine the value of inventory held on hand and you want to display the results in a column labeled TotValue you write the following command
a.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND*P_PRICE AS TOTVALUE
        FROM PRODUCT;
b.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND=P_PRICE AS TOTVALUE
        FROM PRODUCT;
c.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND/P_PRICE AS TOTVALUE
        FROM PRODUCT;
d.
SELECT P_DESCRIPT, P_ONHAND, P_PRICE,P_ONHAND-P_PRICE AS TOTVALUE
        FROM PRODUCT;
 

21. 

The SQL syntax requirements for a list of a table contents for either V_CODE = 21344 or 24288 would be
a.
SELECT P_DESCRIP, P_INDATE, P_PRICE, V_CODE
     FROM PRODUCT
            WHERE V_CODE = 21344
                 OR V_CODE <= 24288
b.
SELECT P_DESCRIP, P_INDATE, P_PRICE, V_CODE
     FROM PRODUCT
            WHERE V_CODE = 21344
                 OR V_CODE => 24288
c.
SELECT P_DESCRIP, P_INDATE, P_PRICE, V_CODE
     FROM PRODUCT
            WHERE V_CODE = 21344
                 AND V_CODE = 24288
d.
SELECT P_DESCRIP, P_INDATE, P_PRICE, V_CODE
     FROM PRODUCT
            WHERE V_CODE = 21344
                 OR V_CODE = 24288
 

22. 

ANSI-standard SQL allows the use of special operator in conjunction with WHERE clause.  Such special operator used to define a range limit is
a.
between.
b.
null.
c.
like.
d.
in.
e.
exists.
 

23. 

ANSI-standard SQL allows the use of special operator in conjunction with WHERE clause.  Such special operator used to check whether an attribute value is null is
a.
between.
b.
null.
c.
like.
d.
in.
e.
exists.
 

24. 

You want the contents of the PRODUCT table listed by P_Price in ascending order listing P_CODE, P_DESCRIPT, P_INDATE, and P_PRICE.

The command will be
a.
SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
      FROM PRODUCT
             SEQUENCE BY P_PRICE;
b.
SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
      FROM PRODUCT
             LIST BY P_PRICE;
c.
SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
      FROM PRODUCT
             ORDER BY P_PRICE;
d.
SELECT P_CODE, P_DESCRIPT, P_INDATE, P_PRICE
      FROM PRODUCT
             ASCENDING BY P_PRICE;
 

25. 

Given the contents of the EMPLOYEE table, the SQL command to list it will be:
a.
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
      FROM EMPLOYEE
           LIST BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
b.
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
      FROM EMPLOYEE
            ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
c.
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
      FROM EMPLOYEE
            DISPLAY BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
d.
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE
      FROM EMPLOYEE
            SEQUENCE BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
 

26. 

To list a unique value, where the list will produce only a list of those values that are different from one another, you will write the command
a.
SELECT ONLY V-CODE
       FROM PRODUCT;
b.
SELECT UNIQUE V-CODE
       FROM PRODUCT;
c.
SELECT DIFFERENT V-CODE
       FROM PRODUCT;
d.
SELECT DISTINC V-CODE
       FROM PRODUCT;
 

27. 

The basic SQL aggregate function that gives the number or rows containing not null values for the given column is
a.
COUNT
b.
MIN
c.
MAX
d.
SUM
e.
AVG
 

28. 

The basic SQL aggregate function that gives the total of all values for a selected attribute in a given column is
a.
COUNT
b.
MIN
c.
MAX
d.
SUM
e.
AVG
 

29. 

The basic SQL aggregate function that gives the arithmetic mean for the specific column is
a.
COUN
b.
MIN
c.
MAX
d.
SUM
e.
AVG
 

30. 

The command to join the PRODUCT (P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE) and VENDOR (V_CODE) tables would be:
a.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE <> VENDOR.V_CODE;
                  ORDER BY P_PRICE;
b.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
                  ORDER BY P_PRICE;
c.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE <= VENDOR.V_CODE;
                  ORDER BY P_PRICE;
d.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE => VENDOR.V_CODE;
                  ORDER BY P_PRICE;
 

31. 

Using the data in the EMP table, how would a list of all employees with their manager's names be generated?
a.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE <> VENDOR.V_CODE;
                  ORDER BY P_PRICE;
b.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE => VENDOR.V_CODE;
                  ORDER BY P_PRICE;
c.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE <= VENDOR.V_CODE;
                  ORDER BY P_PRICE;
d.
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
      FROM PRODUCT, VENDOR
              WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
                  ORDER BY P_PRICE;
 

32. 

You cannot include transaction control SQL statements such as COMMIT or ROLLBACK within the trigger's PL/SQL code.  Trigger(s) for Oracle is/are for
a.
auditing purposes (creating audit logs).
b.
automatic generation of derived column values.
c.
enforcement of business or security constraints.
d.
creating replica tables for backup purposes.
e.
all of the above.
 

33. 

A trigger is procedural SQL code that is automatically invoked by the RDBMS upon the occurrence of a data manipulation event
a.
A trigger is always invoked before or after a data row is selected, inserted, or updated.
b.
A trigger is always associated with a database table.
c.
Each database table may have one or more triggers.
d.
A trigger is executed as part of the transaction that triggered it.
e.
all of the above
 



 
Check Your Work     Reset Help