0% found this document useful (0 votes)
4 views12 pages

Assignment7 SaurabhSinha

The document provides detailed instructions for completing IT547 Assignment 7 using MariaDB. It outlines steps for creating a database and table, loading data from a CSV file, executing various SQL queries, and using indexes to improve query performance. Additionally, it requires students to capture and include screenshots of their results in a Word document.

Uploaded by

Saurabh Sinha
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)
4 views12 pages

Assignment7 SaurabhSinha

The document provides detailed instructions for completing IT547 Assignment 7 using MariaDB. It outlines steps for creating a database and table, loading data from a CSV file, executing various SQL queries, and using indexes to improve query performance. Additionally, it requires students to capture and include screenshots of their results in a Word document.

Uploaded by

Saurabh Sinha
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/ 12

IT547 Assignment 7 Instructions

We are going to use MariaDB (command prompt) for this Lab Assignment. Create a Word document
named Lab9.docx

Steps:

1) Log into your installation of MariaDB at the command prompt

2) Create a database named Lab9LastName

 Type in CREATE DATABASE Lab9LastName; *LastName should be your last name such
as Lab9Heiden (for me).
 To verify the database is created type SHOW DATABASES;
 Provide SCREENSHOT 1 of the results (in Word document)
3) Set lab9heiden as current database by typing USE DATABASE lab9heiden;

4) Create the table “movie”

 Type in CREATE TABLE movie (ID int, ReleaseYear int, Title varchar(255), OriginEthnicity
varchar(255), Director varchar(255), PRIMARY KEY (ID));
 Then type in show tables; to confirm the creation of the table.
 Then type in describe movie; to confirm the fields are created properly.
 Provide SCREENSHOT 2 of the results (in Word document)
5) Let’s download the data.

Please download the file that is provided wiki_movie.csv.

Now load it into the data directory. You can copy it to the file – if it is on Microsoft Windows it may be in
the C:\Program Files\MariaDB 10.6\data . Specifically, there should be a folder for your database –
lab9heiden.
6) Load the data into the table “movie”

 Now type LOAD DATA INFILE 'wiki_movie.csv' IGNORE INTO TABLE movie COLUMNS
TERMINATED BY ',';
 Now let’s get a count of the records in the table by typing in select count(*) from movie;
 Provide SCREENSHOT 3 of the results (in Word document)

7) Count how many records have the word and in the title using the LIKE operator looking for a
movie title with face in it.

 Type in select count(*) from movie where title like '%face%';


 Provide SCREENSHOT 4 of the results (in Word document)
8) Write a query with the fields that demonstrates how much server time it takes for the query when
not using an index.

 Type in the following: select ID, ReleaseYear, Title, OriginEthnicity, Director from movie where
title like '%face%';
 Provide SCREENSHOT 5 of the results (in Word document)

9) Again write a query to count the records with the word face in the title and mention the server time
it takes for the query without index to run.

 Type in: select count(*) from movie where title like '%face%';
 Provide SCREENSHOT 6 of the results (in Word document)
10) Add an index on the title field that will help increase results time.

 Type in: CREATE INDEX index_title on movie(title);


 Type in: SHOW INDEXES FROM movie;
 Provide SCREENSHOT 7 of the results (in Word document)

11) Use the index to see the results of using an index instead of a full table search with the count(*).

 Type in select count(*) from movie where title like '%face%';


 Provide SCREENSHOT 8 of the results (in Word document)
12) Use the index to see the results of using an index instead of a full table search with all of the
fields.

 Type in the following: select ID, ReleaseYear, Title, OriginEthnicity, Director FROM movie WHERE
title like '%face%';
 Provide SCREENSHOT 9 of the results (in Word document)

You might also like