SQL Programming Lab 3
September 28, 1999
In this lab you will be answering some questions by performing queries against the pubs2 database I introduced you to last week.
SELECT * FROM titles
SELECT title_id FROM titles
SELECT t.title FROM titles t, titleauthor ta, authors a
WHERE a.au_lname = ‘Green’ and
t.title_id = ta.title_id and
a.au_id = ta.au_id
Now answer the following questions by creating and executing SQL statements against the pubs2 database. Use the table handouts to help figure out which tables contain the data you want to access.
SELECT au_fname, au_lname FROM authors WHERE state = 'CA'
SELECT stor_name FROM stores WHERE state = 'CA'
SELECT t.title
FROM titles t, titleauthor ta, authors a
WHERE t.title_id = ta.title_id and
ta.au_id = a.au_id and
au_fname = 'Marjorie' and
au_lname = 'Green'
SELECT t.title
FROM titles t, publishers p
WHERE t.pub_id = p.pub_id and
p.pub_name = 'Algodata Infosystems'