Lab 5: Connecting to the Database

Agnessalidvl
AGLab04.docx

Laboratory Report DeVry University College of Engineering and Information Sciences

Course Number: DBM405A

Professor:

Laboratory Number: 4

Laboratory Title: Tables and Indexes

Submittal Date: 3/31/2019

Note: There is no limit on how much information you will enter under the three topics below. It is important to be clear and complete with your comments. Like a scientist, you are documenting your progress in this week’s lab experiment.

Objectives: In your own words, what was this lab designed to accomplish? What was its purpose?

This lab was designed to make students familiar with the advance things in MySQL. The first things which is covered in this lab is how to play with DDL. Because this lab covers alteration of table, dropping of table and at last renaming a table.

After this indexing is covered in this lab, this lab covers how to create an index and how to write queries using those indexes.

Results: Discuss the steps you used to complete your lab. Were you successful? What did you learn? What were the results? Explain what you did to accomplish each step. You can include screen shots, code listings, etc. to clearly explain what you did.

1. New table Next season generated containing all the attributes and data of table season

NextSeason Table

Season table

2. New field Innings added in NextSeason Table

Using query

ALTER TABLE `nextseason` ADD `Innings` INT NOT NULL AFTER `AwayTeamScore`;

3. Structure of PastInnings changed and the field Innings added in it

Using query

ALTER TABLE `pastseasons` ADD `Innings` INT NOT NULL AFTER `AwayTeamScore`

4. Season table deleted

Using query

drop table season

5. Table ‘Nextseason’ renamed to ‘Season’

Using Query

RENAME TABLE nextseason to season

6. Created index for table teams on teamcode.

Using Query

CREATE INDEX idx_teamcode ON teams (teamcode)

7. Created index for table players in attribute team.

Using query

CREATE INDEX idx_team ON players (team)

8. Displaying each team and the associated players on each team.

Using Query

SELECT teamcode, TName, FirstName, LastName

from teams, players

where teamcode = players.team

Conclusions: After completing this lab, in your own words, what conclusions can you draw from this experience?

After completing this lab I got familiar with the advance things in MySQL. The first things which I learnt is how to play with DDL. Because this lab covered alteration of table, dropping of table and renaming a table as well.

After this I got familiar with indexing that how to create an index and how to write queries using those indexes.

Student:

Name

Program

Signature