0% found this document useful (0 votes)
25 views2 pages

SQL pubDB Moreproblems

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

SQL pubDB Moreproblems

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

• Below the pub database details is given:

1. PUBLISHER(pub_id, pub_name, city, state, country)

2. AUTHOR(au_id, au_lname, au_fname, phone, address, city, state, zip, country,


contact)

3. TITLEAUTHOR(au_id, title_id, au_order, royalityshare)

4. TITLES(title_id, title, type, pub_id, price, advance, royalty, ytd_sales,


notes, pub_date)

5. SALE(stor_id, order_num, title_id, ord_date, discount, quantity, payment_term)

6. STORE(stor_id, stor_name, address, city, state, zip, country)

7. DISCOUNT(discount_type, stor_id, discount)

8. EMPLOYEE(emp_id, fname, lname, job_id, pub_id, hire_date, job_lvl, city,


state, country)

9. JOB(job_id, stor_id, min_lvl, max_lvl)

10. COUNTRY(country, Continent)

Answer the following queries using proper SQL statements:

a. Display the name of the employees who works in USA.

b. Display the types of the book with number of books in each type given that the
books are written by American authors.

c. Display no of employees at each USA based publishers.

d. Display total sell of all the stores that give discount over 5%.

e. Find the earning of the authors who lives in USA.

f. Display the employees that work for more than 5 years in the stores located in
US and provide more than 5% discount.

g. Display total amount of sell of all books that are published by USA based
publishers.

h. Display total number of orders issued for ‘business’ type book.

i. Display the employees who worked at USA based stores that earned more than
$50,000 by selling books.

j. Display the store names that sell more that $20,000 and have sold at least 5
types of books.
• Below we provide the details of pubs database:

1. PUBLISHER(pub_id, pub_name, city, state, zip, country)


2. AUTHOR(au_id, au_lname, au_fname, phone, address, city, state, zip, country)
3. TITLEAUTHOR(au_id, title_id, au_order, royalityshare)
4. TITLES(title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes,
pub_date)
5. SALE(stor_id, order_num, title_id, ord_date, quantity, payment_term)
6. STORE(stor_id, stor_name, address, city, state, zip, country)
7. EMPLOYEE(emp_id, fname, lname, job_id, pub_id, hire_date, job_lvl, city, salary,
state, country)
8. JOB(job_id, stor_id, min_lvl, max_lvl)
9. COUNTRY(country, continent)

Answer the following queries using proper SQL statements:


a. Create PUBLISHER table.
b. Increase price of Titles by 15% for the titles belong to Computer Science
category.
c. List total Bangladeshi Publishing Houses that have published more than 5000
titles.
d. List the type and the title that is the highest price among that category.
e. List the name of the country (one or more) that has maximum no of stores.
f. Find total sale of “Adorsha Book center” located at Dhaka 1217 in Bangladesh.
g. Find total salary related expenses of Adorsha Book center” located at Dhaka 1217
in Bangladesh.
h. Find total number of titles written by Asian Authors.
i. Find the name of the title that has provided Maximum advance to the Authors.
j. Find the name of the titles that were not sold yet.

You might also like