SQL Programming Lab 4
October 5, 1999
Start a scripting session and answer the following questions. Then mail your script to
jlaker@udel.edu with "ISQL Lab 4" as the subject.Use the pubs2 database.
Solution:
SELECT t.title, a.au_fname, a.au_lname
FROM titles t, titleauthor ta, authors a
WHERE a.au_id = ta.au_id and
ta.title_id = t.title_id and
title like '%Computer%'
Solution:
SELECT title
FROM titles
WHERE price > $15.00
Solution:
SELECT total_sales
FROM titles
WHERE title = 'Sushi, Anyone?'
SELECT title, pub_name
FROM titles t, publishers p
WHERE t.pub_id = p.pub_id and
t.total_sales > (value from previous query)
Solution:
SELECT t.title, a.au_fname, a.au_lname
FROM titles t, titleauthor ta, authors a
WHERE a.au_id = ta.au_id and
ta.title_id = t.title_id and
t.type = 'business'
Solution:
SELECT t.title, a.au_fname, a.au_lname, p.pub_name
FROM titles t, authors a, titleauthor ta, publishers p
WHERE a.au_id = ta.au_id and
ta.title_id = t.title_id and
t.pub_id = p.pub_id and
t.type = 'psychology'