Exercise 2
CS122, Spring 2004
Thursday, April 1
Use Student.mdb:
1. (3pt each) Chapter 2, Ex 4, 5, 6, 8, 9, 10, 11, and 12. Please name
and save your queries for each problem as Query1.4, Query1.5, ..., Query1.12.
Use Movies.mdb:
2. (4pt) Write a query to display all movies names starting with the
letters A-L in
ascending order.
3. (4pt) Write a query to display the names of the movies whose box
office ranking has
gone up this week.
Discussion:
[Query 1.4] SELECT bldg AS [Building Number], room AS [Room Number],
capacity AS [Room Capacity] FROM Room ORDER BY capacity DESC;
- Circular reference
- "", '', []
[Query 1.5] SELECT course_num AS [Course Number], instructor AS
[Instructor Name], bldg AS [Building Number] FROM Section
WHERE year='98' AND semester='Fall';
[Query 1.12] SELECT sname AS [Student Name], Major, class as
[Class Level] FROM Student ORDER by major, class;
- ORDER by a, b
- ORDER by a AND b
[Query 2] SELECT title from Box_Office WHERE title >= 'A' AND
title < 'M' ORDER BY title;
- String order and comparison
- BETWEEN
[Query 3] SELECT title, this_week, last_week FROM Box_Office
WHERE this_week < last_week;