0% found this document useful (0 votes)
38 views5 pages

Quer Ryy

The document contains SQL statements that create a table to store customer order data, inserts data into that table for multiple customer orders, creates a customer table, and inserts customer records. It also includes some sample SELECT queries to analyze the order and customer data.

Uploaded by

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

Quer Ryy

The document contains SQL statements that create a table to store customer order data, inserts data into that table for multiple customer orders, creates a customer table, and inserts customer records. It also includes some sample SELECT queries to analyze the order and customer data.

Uploaded by

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

create table ItemsOrdered (

CustomerID int not null,

OrderDate date,

Item varchar (20),

Quantity int,

Price float

);

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '1999-06-30','Raft','1','58.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10298', '1999-07-01','Skateboard','1','33.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '1999-07-01','Life vest','4','125.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10299', '1999-07-06','Parachute','1','1250.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10339', '1999-07-27','Umbrella','1','4.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449','1999-08-13','Unicycle','1','180.79');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10439', '1999-08-14','Ski Poles','2','25.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '1999-08-18','Rain Coat','1','18.30');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449', '1999-09-01','Snow Shoes','1','45.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10439', '1999-09-18','Tent','1','88.00');
Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10298', '1999-09-19','Lantern','2','29.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10410', '1999-10-28','Sleeping Bag','1','89.22');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10438', '1999-11-01','Umbrella','1','6.75');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10438', '1999-11-02','Pillow','1','8.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10298', '1999-12-01','Helmet','1','22.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449', '1999-12-15','Bicycle','1','380.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449', '1999-12-22','Canoe','1','280.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '1999-12-30','Hoola Hoop','3','14.75');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10330', '2000-01-01','Flashlight','4','28.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '2000-01-02','Lantern','1','16.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10299', '2000-01-18','Inflatable Mattress','1','38.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10438', '2000-01-18','Tent','1','79.99');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10413', '2000-01-19','Lawnchair','4','32.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10410', '2000-01-30','Unicycle','1','192.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)


VALUES('10315', '2000-02-02','Compass','1','8.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449', '2000-02-29','Flashlight','1','4.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10101', '2000-02-08','Sleeping Bag','2','88.70');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10298', '2000-03-18','Pocket Knife','1','22.38');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10449', '2000-03-19','Canoe Paddle','2','40.00');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10298', '2000-04-01','Ear Muffs','1','12.50');

Insert into itemsordered ( CustomerID,OrderDate,Item,Quantity,Price)

VALUES('10330', '2000-04-19','Shovel','1','16.75');

create table Customer (

CustomerID int not null,

FirstName varchar (20),

LastName varchar (20),

Brgy varchar (20),

City varchar (20)

);

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10101','Lorete','Tindoc','Domingo','Cainta');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10298','Melanie','Reyes','Pinagbuhatan','Pasig');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10299','Ria','Gagarin','Upper Bicutan','Taguig');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)


VALUES ('10315','Mike','Sunday','Sucat','Paranaque');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10325','Cess','Bermas','Cubao','Quezon City');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10329','Geng','Juan','Commonwealth','Quezon City');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10330','Dave','Mendoza','Holy Spirit','Quezon City');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10338','Chat','Sabate','San Isidro','Cainta');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10339','Joyce','Alapits','Dolores','Cainta');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10408','Kikay','Lu','Santolan','Pasig');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10410','Mark','de Ramos','Charleston','Pasay');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10413','Biseo','Francisco','Sta.Ana','Pateros');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10419','Ben','Adama','Poblacion','Pateros');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10429','Sarah','Gee','Manggahan','Pasig');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10438','Jhanine','Cute','Parang','Marikina');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10439','Lala','Montenegro','Nangka','Marikina');

Insert into Customer (CustomerID,FirstName,LastName,Brgy,City)

VALUES ('10449','Jenny','Bob','San Mateo','Rizal');


1. SELECT MAX(Price) as MAXPrice from itemordered;

2. SELECT AVG (Price) FROM itemsordered

WHERE OrderDate = 12;

5. SELECT City, COUNT(City)

FROM customer

GROUP BY City;

6. SELECT Item, MAX(Price), MIN(Price) FROM itemsordered

GROUP BY Item;

7. SELECT CustomerID, COUNT(Quantity), SUM(Price) FROM itemsordered

GROUP BY CustomerID;

You might also like