4.3: Projection Query
- Page ID
- 15512
Next we build a query that displays a subset of the columns of a table. Suppose we need to produce a listing of call numbers and titles. Proceed as in the previous example so that the Book table is shown in the Relationships area. Now, double-click the callNo and title fields:

The definition of the query is now complete. The grid area indicates the fields involved, and both fields will be displayed because each has a check mark on the Show line. Only fields checked on the Show line are displayed in the results. Running this query yields:
callNo |
Title |
---|---|
CB 351 M293 1983 |
Atlas of medieval Europe |
HQ 1143 P68 1975 |
Medieval women |
PC 14 V48 1965 |
Medieval miscellany |
QA 76.73 S67C435 2004 |
Joe Celko's Trees and hierarchies in SQL for smarties |
QA 76.73 S67C46 1997 |
Joe Celko's SQL puzzles & answers |
QA 76.76 A65P76 2011 |
Programming Android |
QA 76.9 D26H355 2008 |
Information modeling and relational databases |
QA 76.9 D26H39 1996 |
Data model patterns : conventions of thought |
QA 76.9 D35C45 1999 |
Joe Celko's data & databases : concepts in practice |
R 141 E45 2006 |
Medieval medicine and the plague |
R 487 T35 1967 |
Medicine in medieval England. |
Save the query. A projection query, because it displays a subset of the fields in the table, is said to produce a vertical slice of the table.