Try Another
Display the skills available in the company, as you did earlier, but list them in numeric order to make it easier to scan. Show both skill ID and skill name from the SKILL table.
The result looks like this:
SKILL_ID SKILL_NAME -------- ---------- 1000 Management 1030 Acct Mgt 3065 Electronics 3088 Brake work 3333 Bodywork 4250 Data Entry 4370 Filing 4410 Typing 4420 Telephone 4430 Interviewing 4444 Assembly 4490 Gen Ledger 5130 Basic Math 5160 Calculus 5180 Statistics 5200 Gen Acctng 5309 Appraising 5420 Writing 5430 Mktng Writing 5500 Gen Mktng 6470 Window Installation 6650 Diesel Engine Repair 6666 Billing 6670 Gas Engine Repair 6770 Purchasing 7000 Sales 26 rows processed
If your results do not match what you see above, check Review Answers for Chapter 3 for the correct SQL syntax. Remember that result tables may be shortened in this guide.
Multiple Sort Columns
You've seen how to sort selected rows by specifying ORDER BY and a column name. If you specify more than one column name after ORDER BY, SQL sorts rows by the first column named, then by the second column named, and so on.
How It's Done
You often want to sort all employees by first name within last name for an employee list. To do this, enter:
select emp_lname, emp_fname
from employee
order by emp_lname, emp_fname;
The result looks like this:
EMP_LNAME EMP_FNAME --------- --------- Albertini Joan Alexander David Anderson Alice Baldwin James Bennett Patricia Bradley George Brooks John Carlson Thomas Catlin Martin Clark Robert Courtney Cecile Crane Herbert Cromwell Michelle Dexter Janice Donelson Julie Ferguson Adele Ferndale Jane Fordman Timothy Gallway James Griffin William Halloran Martin Hamel Marylou Jacobs Mary Johnson Carolyn Johnson Eleanor Loren Martin Lowe Frank Lynn David MacGregor Bruce Mills Thomas Moore Richard Park Deborah Parker Cora Robinson Judith Roy Linda Sampson Ralph Smith Carl Smith Michael Spade Samuel Taylor Cynthia Thompson Henry Thompson Jason Thompson Thomas Thurston Joseph Umidy Mary Voltmer Louise White Mark White Peter Widman Susan Wilder Ronald Wilkins Fred Williams Catherine Wills Stephen Wooding Alan Zander Jonathan 55 rows processed
|
Copyright © 2014 CA.
All rights reserved.
|
|