You are on page 1of 1

Sunday, 11 October 2020, 12:00 AM

Lab 5
1. Use the "classicmodels" database from Lab 2.
2. Select the "classicmodels" as your current database.
3. Develop statements to do the following tasks:
1. Select customerNumber, COUNT(*) alias 'Number of Orders', from the orders table,
where the year of the shippedDate = 2005. Group by customerNumber.
2. Select productCode, SUM(quantityOrdered * priceEach) alias Total from the orders
table. Create an inner join with the orderdetails table on the orderNumber. Group by the
productCode, having a productCode between 'S00' and 'S50'. Sort descending, by total.
4. Test the commands in the mysql.
5. When you have been able to test it successfully, copy the scripts into notepad. 
6.  Finally, copy the script from Notepad to this Lab.

Lab 6
Sunday, 11 October 2020, 12:00 AM

Objective: To practice a number of statements involved in the modification of data.


Directions:

 Use the "classicmodels" database from Lab 2.


 Select the "classicmodels" as your current database.
 Develop statements enable copying data from one table to another using the SELECT
statement.
o Create & populate the Tasks table as follows:
 CREATE TABLE tasks (id int(11) NOT NULL AUTO_INCREMENT PRIMARY
KEY, title varchar(255) NOT NULL, start_date date NOT NULL, end_date date NOT
NULL);
 INSERT INTO tasks(id, title, start_date, end_date) VALUES ('Learn
MySQL','2010-01-01','2010-01-20'), ('Intermediate MySQL','2011-03-01','2011-04-05'),
('Advanced MySQL','2011-05-01','2011-06-15');

o Create the "tasks2" table using the structure of the "tasks" table.
o Using the INSERT and SELECT statements, copy the data from the tasks table to
the tawosks2 table.

 When you have been able to test it successfully, copy the scripts into a tool like Notepad is. 

You might also like