Datasheet

60
Chapter 1
Introducing SQL
A. SELECT * FROM products
WHERE shelf like ‘%BL’
ORDER BY available_qty SORT DESC;
B. SELECT * FROM products
WHERE shelf like ‘BL%’;
C. SELECT * FROM products
WHERE shelf = ‘BL%’
ORDER BY available_qty DESC;
D. SELECT * FROM products
WHERE shelf like ‘BL%’
ORDER BY available_qty DESC;
E. SELECT * FROM products
WHERE shelf like ‘BL%’
ORDER BY available_qty SORT;
24. The EMP table has the following data:
EMPNO ENAME SAL COMM
---------- ---------- ---------- ----------
7369 SMITH 800
7499 ALLEN 1600 300
7521 WARD 1250 500
7566 JONES 2975
7654 MARTIN 1250 1400
7698 BLAKE 2850
7782 CLARK 2450
7788 SCOTT 3000
7839 KING 5000
7844 TURNER 1500 0
7876 ADAMS 1100
7900 JAMES 950
7902 FORD 3000
7934 MILLER 1300
Consider the following two SQL statements:
1. SELECT empno, ename, sal, comm
FROM emp WHERE comm IN (0, NULL);
2. SELECT empno, ename, sal, comm
FROM emp WHERE comm = 0 OR comm IS NULL;
A. 1 and 2 will produce the same result.
B. 1 will error; 2 will work fine.
C. 1 and 2 will produce different results.
D. 1 and 2 will work but will not return any rows.
95127c01.indd 60 2/18/09 6:37:12 AM