Database Reference
In-Depth Information
12.6 Simple Queries
We will use the following format for a simple query:
Example 13:
List name and ID of students enrolled in “BSC1” program:
Example 14:
List all courses offered:
Example 15:
Refer to the supplier-items database of earlier Chapters (3 and 4).
Suppose that we have relations
InventoryItem
{Item#, ItemName, ItemPrice, Weight, …},
Supplier
{Sup#, Sname, Scity, …} and
Schedule
{Sup#, Item#, Qty …}. We wish to show
shipment amount on item received. Suppose each shipment is a box of 12 items. We
could have the following query:
The result would look like this:
Example 16:
Produce a list of students (showing the student's full name and
StudentID) from Chancellor Hall sorted on first name within surname: