You are on page 1of 3

Database Management Systems

Assignment #11
Topic: MySQL Indexing
Objectives: Understand the concept of MySQL Indexing.
How to submit your work
• Change file name as
File name: Lab08_[studentid]_[ student name].pdf
Example: Lab08_6431503xxx_Kati.pdf
• Submit a file in LMS before the due date.

Preparation
1. Download world.sql from LMS.
2. Create a database “world” in MySQL.
3. Import the SQL from the file to create tables and add data.
4. You will have three tables with data: city, country, and countrylanguage.
5. You are now ready for the assignment.

Exercise
1. Create an index on the CountryCode column in the city table.

Answer here

2. Exercise: Create a unique index on the combination of CountryCode and Language columns in
the countrylanguage table.

Answer here

Page 1 of 3
3. Create an index on the Population column in descending order.

Answer here

4. Create an index on the SurfaceArea column, but exclude rows where SurfaceArea is 0.00.

Answer here

5. Consider the statement and create index for it:


SELECT

c.Name AS CityName,

c.Population AS CityPopulation,

co.Name AS CountryName,

cl.Language AS OfficialLanguage

FROM

city c

JOIN country co ON c.CountryCode = co.Code

JOIN countrylanguage cl ON co.Code = cl.CountryCode AND cl.IsOfficial = 'T';

Answer here

Page 2 of 3
Page 3 of 3

You might also like