text
stringlengths
0
359
http://www.cs.jhu.edu/~yarowsky/jhu.sql
https://www.classes.cs.uchicago.edu/archive/2015/spring/23500-1/hw3.html
q0. Retrieve the title of each painting, the artist's last name, its height in inches and its width in inches in descending order of surface area.
q1. Retrieve the artistID, first name, last name, and age at death of the artist(s) who was/were youngest at the time of death. (Note that since the birth and death dates are given as years only, any age computation is approximate, accurate plus or minus one.)
q2. Retrieve the titles of all paintings and sculptures, with the artists' last names, in the database and the age the artist was at the time the work was produced, in order of youngest to oldest such age.
q3. Retrieve the artist's last name and the title of all the undisplayed works.
q4. Write a query to display the artistID, last name and all (distinct) media used by all artists in all paintings. Order the query result by last name, ascending. Your results should include not just the medium ("oil") but the surface the medium is on ("oil on canvas"). Use GROUP_CONCAT to denormalize the data and produce comma-delimited results like this:
Total # = 51
1. What is the most expensive cake and its flavor?
select id, flavor
from goods
where food = "Cake"
order by price desc
limit 1
What is the cheapest cookie and its flavor?
select id, flavor
from goods
where food = "Cookie"
order by price
limit 1
2. Find the ids of goods that have apple flavor.
Select id
From goods
Where flavor = "Apple"
What are the ids of goods that cost less than 3 dollars?
Select id
From goods
Where price < 3
3. List the distinct ids of all customers who bought a lemon cake?
Select DISTINCT T3.CustomerId
From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.Id = T2.Item and T2.Receipt = T3.ReceiptNumber
Where T1.Flavor = "Lemon" and T1.Food = "Cake"
For each type of food, tell me how many customers have ever bought it.
Select T1.food, count(distinct T3.CustomerId)
From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.Id = T2.Item and T2.Receipt = T3.ReceiptNumber
Group by T1.food
4. Find the id of customers who shopped at the bakery at least 15 times.
Select CustomerId
From receipts
Group by CustomerId
having count(*) >= 15
What is the last name of the customers who shopped at the bakery more than 10 times?
Select T2.LastName
From receipts as T1 JOIN customers as T2 ON T1.CustomerId = T2.id
Group by T2.id
having count(*) > 10
5. How many types of Cake does this bakery sell?
Select count(*)
From goods
where food = "Cake"
List all the flavors of Croissant available in this bakery.
Select flavor
From goods
where food = "Croissant"
6. Give me a list of all the distinct items bought by the customer number 15.
Select distinct T1.item
from items as T1 JOIN receipts as T2 ON T1.receipt = T2.ReceiptNumber
Where T2.CustomerId = 15
For each type of food, what are the average, maximum and minimum price?
Select food, avg(price), max(price), min(price)
from goods
Group by food
7. Find the receipt numbers where both Cake and Cookie were bought.
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
6
Edit dataset card