Lab11 - Index and View

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

2814ICT - Data Management &

7003ICT - Database Design

Weekly Workshop/
Lab Activities for
Week 11

By: Dr. Mohammad Awrangjeb

Nathan & Logan Campuses

Page | 0
Activity Set 1: Index and View [Individual Activity] [30 min]
Objectives:
 To investigate views & indexes

Requirements:
 MovieCo database
 Import the following files:
o Week 8_lab_create.txt
o Week 8_lab_insert.txt
 MovieCo ERD has been copied from Week 8 lab sheet here:

 The data in six tables are shown below:

Page | 1
Page | 2
Index:
Select MovieCo database, go to the SQL table and write the SQL statements necessary to provide the
following:

1) Show the index on following tables: Membership, Price, and Movie. Explain briefly some of the
features in the output.

2) Create following index:


Index name Index types Columns Table
MovieName Non-unique Movie_Title Movie
YearOfRelease Non-unique Movie_Year Movie
MemberFullName Unique Mem_FName, Mem_LName Membership

After creation, show the indexes of each table.

3) Drop the index you have created above. If you show the index in tables after dropping, you will
see indexes are now like they were in the original table!

View:
Select MovieCo database, go to the SQL table and write the SQL statements necessary to provide the
following:

1) Create a new view called AddressBook from the Membership table. The view should contain the
Member ID, Full Name, and Full Address.

Page | 3
2) Show the AddressBook view by clicking Views as follows:

3) Now, update the member name and address of the member with ID 107 as
follows:

First Name: Rosario


Last Name: Jackson
Street: 107 Technology Lane
City: Nathan
State: LA
Zip: 4111

After the above update see the update both in the membership table and
AddressBook view!

4) Now, insert a new member as follows:

Member ID: 222


Page | 4
First Name: Mohammad
Last Name: Awrangjeb
Street: 25 Gold Coast Highway
City: South Port
State: QLD
Zip: 4244
Balance: 10

After the above insertion see the update both in the membership table and
AddressBook view!

Activity Set 2: Assignment (Part 2) [Individual Activity] [80 min]


Objectives:
 Complete the assignment
 Make sure what you need: submission files and format, deadline, etc.

Requirements:
 Students are advised to attend as many labs as they want in this week.
 Get feedback, correct your solutions and proceed to finalise your submission online
 Remember, you will need to complete Weeks 7-10 lecture concepts and lab activities to
perform Tasks 1 to 3 as follows:
Tasks Concepts & Activities to follow Consultation in Weeks
Task 1 Week 7 Week 9
Task 2 Week 7 Week 10
Task 3 Weeks 8-10 Week 11
 See the detail requirements in the assignment specification file.

Advice to follow before you submit:


• Watch the Assignment briefing videos.
• Make sure that you have followed all specifications mentioned in the Assignment
specification file.
• While preparing your answer to each of the assignment questions, also follow the help
information provided in the FAQ - about Assignment Questions file (if available).
• Watch relevant help videos available.
• Double check your answer to each of the assignment Task to ensure that it conforms to all
specifications mentioned in the above resources.
• In fact, you need to create THREE (3) separate files for three tasks as follows. See detail in
the assignment specification file.

Tasks Description File you create (e.g., with ID F01)


Task 1 Create database and create tables Create_F01.txt
Task 2 Insert data into tables Insert_F01.txt
Task 3 Write queries Queries_F01.txt
• Attention Mac users: Your MySQL database should run on Windows version of XAMPP. The
teaching team/markers have access to the Windows machines only. So, for the convenience
Page | 5
we suggest that you import your database files and run the queries on Windows machines
available in the labs. Make sure all files are working in Windows machines before you
submit.
• You should transfer all the queries of Task 3 and the output each query to the template file
‘2814ICT-7003ICT_2019T1_Template_Assignment_Part 2.docx’.
• In this template file, fill in the first page with your details (signatures by all group members
are required). Provide a table of content and the list of people to whom you discussed your
assignment on Page 2. Copy your solution to each query and its output into the template file
(from Page 3 onward).
• Once you are happy with your answers, ZIP all FOUR (4) files above into a single file as
'a2_F01.zip' (with ID F01).
• Make sure that your assignment ZIP file can be unzipped/opened properly before you
submit it. Try on different machines.
• If you are using computers other than Windows (e.g., Mac), make sure you create the ZIP file
into a Windows machine (e.g., use lab computers in Windows) and test your file can be
properly opened/unzipped.
• When your ZIP file is ready and you want to submit, submit online.

Submission deadline:
• For deadline, see the course website.
• Submit online at the course website

Page | 6

You might also like