January 2005
Beginner to intermediate
928 pages
22h 14m
English
Let's review some of the SQL statements you have learned in this chapter. This section gives scenarios and then shows the commands and resulting output.
1. | Return a result of deptno, admrdept, and a derived comment column from the department table where deptname contains CENTER. Order the result with the first column of the result set.
SELECT deptno , admrdept , 'it is a center' AS comment FROM department WHERE deptname LIKE '%CENTER%' ORDER BY 1 DEPTNO ADMRDEPT COMMENT ------ -------- -------------- C01 A00 it is a center D01 A00 it is a center 2 record(s) selected. |
2. | Return the name and id of staffs whose year of service is NOT NULL. Order the result by years and id. Fetch only the first five rows of the result.
SELECT years ... |
Read now
Unlock full access