![](../../../files/library/images/decorations/blank.gif)
CISC 7510X
Main
Files
Syllabus
Links
Homeworks
Notes
0001
DB1
Intro
SQL Intro
SQLRunner
|
![](../../../files/library/images/decorations/vertial_bar_top_small_0001.gif) |
![](../../../files/library/images/decorations/blank.gif) |
CISC 7510X
(DB1) Homeworks
You should EMAIL me homeworks, alex at theparticle dot com. Start email subject with "CISC 7510X HW#". Homeworks without the subject line risk being deleted and not counted.
CISC 7510X
HW# 1 (due by 3rd class;): For the below `store' schema:
product(productid,description,listprice)
customer(customerid,username,fname,lname,street1,street2,city,state,zip)
purchase(purchaseid,purchasetimestamp,customerid)
purchase_items(itemid,purchaseid,productid,quantity,price)
Using SQL, answer these questions (write a SQL query that answers these questions):
- What is the description of productid=42?
- What's the name and address of customerid=42?
- What products did customerid=42 purchase?
- List customers who bought productid=24?
- List customer names who have never puchased anything.
- List product descriptions who have never been purchased by anyone.
- What products were purchased by customers with zip code 10001?
- What percentage of customers have ever purchased productid=42?
- Of customers who purchased productid=42, what percentage also purchased productid=24?
- What is the most popular (purchased most often) product in NY state?
- What is the most popular (purchased most often) product in Tri-state Area? (NJ, NY, CT)
- Who purchased productid=24 prior to July 4th, 2020?
- For each customer, find all products from their last purchase.
- For each customer, find all products from their last 10 purchases.
- Names of customers who have purchased product 42 in the last 3 months.
Also, install PostgreSQL.
|
![](../../../files/library/images/decorations/blank.gif) |