text
stringlengths 0
359
|
|---|
From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber
|
Group by T3.CustomerId
|
having sum(T1.price) > 150
|
Find the ids of customers whose average spending for each good is above 5.
|
Select 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 T3.CustomerId
|
having avg(T1.price) > 5
|
On which day did the bakery sell more than 100 dollars in total.
|
Select T3.date
|
From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber
|
Group by T3.date
|
having sum(T1.price) > 100
|
http://users.csc.calpoly.edu/~dekhtyar/365-Spring2017/index.html
|
Find all chocolate-flavored items on the menu whose price is under $5.00. For each item output the flavor, the name (food type) of the item, and the price.
|
Report the prices of any lemon-flavored items. Output the flavor, the name (food type) and the price of each pastry.
|
Find all customers who made a purchase on October 3, 2007. Report the name of the customer (first, last).
|
Find all types of cookies purchased by KIP ARNN during the month of October of 2007. Report each cookie type (flavor, food type) exactly once.
|
Report the total amount of money NATACHA STENZ spent at the bakery during the month of October, 2007.
|
Find all customers who purchased, during the same trip to the bakery, two different Croissants. Report first and last names of the customers.
|
Find the total amount of money the bakery earned in October 2007 from selling eclairs. Report just the amount.
|
Report all days on which more than ten tarts were purchased.
|
For each purchase made by NATACHA STENZ output the receipt number, the date of purchase, the total number of items purchased and the amount paid.
|
Find the customer(s) who spent the most on pastries in October of 2007. Report first and last name.
|
Find the type of baked good (food type, flavor) responsible for highest total revenue.
|
Find the day of the highest revenue in the month of October, 2007.
|
Find the best-selling item (by number of purchases) on the day of the highest revenue in October of 2007.
|
https://github.com/ferreiro/SQL-Oracle-databases/blob/master/2_SQL_Queries/Block1%20(AllTheBooks%20Table).sql
|
List of books, the publication year of each of them and their authors, ordered by publication year
|
List of books that were published before 01-01-2000.
|
List of clients that have bought at least one book.
|
List of clients that bought the book whose ISBN= 4554672899910.
|
List of clients whose name contains ‘Jo’ and the books that they have bought.
|
List of clients that have bought at least a book whose price is greater than 10.
|
List of clients that have placed more than one order in the same date.
|
List of clients and dates in which they have placed orders that have not been sent yet.
|
List of clients that have not bought books whose price is greater than 10.
|
List of books whose sale price is greater than 30€ or that were published before 2000.
|
List of books and amount of copies of each of them that have been sold.
|
List of clients and the total amount that they have spent in the bookstore.
|
Profits obtained from sales of books.
|
Orders whose total amount is greater than 100.
|
Orders and the total amount of each of them that contains more than a book (title).
|
Orders and the total amount of each of them that contains more than 4 copies
|
List of the most expensive books.
|
List of books that have not been sold or that have been sold but the profit per copy is less than 5
|
List of clients that have bought more than one copy of a book sometime
|
SELECT TITLE, AÑO "YEAR", NAME "Author name"
|
FROM BOOK NATURAL JOIN AUTHOR_BOOK, AUTHOR
|
WHERE AUTHOR_BOOK.AUTHOR=AUTHOR.IDAUTHOR
|
ORDER BY AÑO;
|
SELECT TITLE, AÑO
|
FROM BOOK
|
WHERE AÑO<'2000';
|
SELECT DISTINCT IDCLIENT, NAME
|
FROM CLIENT NATURAL JOIN ORDERS;
|
select distinct client.name, Client.IdClient
|
from Client, Orders where
|
Client.IdClient=Orders.IdClient;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.