Professional Documents
Culture Documents
This is an individual assignment and must be the product of your own work. Students are reminded
to read the pages related to assessment rules, including rules for dishonest work, in the Toiohomai
Student code of practice.
This assignment, with the completed standard cover sheet (available from CTC Reception) attached,
must be submitted to your lecturer in hard copy into the assignment drop box (at CTC reception
AFTER it has been date stamped).
Also an electronic copy (including the report and all SQL saved files
) is to be emailed to your lecturer (Bahram.Pishravi@toiohomai.ac.nz) by the due date and time. The
subject should have a format like: “Comp.5205- Assignment1--Your name- Student ID”
Late assignments will not be marked; nor will any without the BITA date stamp on the cover sheet.
No hand written assignment will be accepted, the minimum tool you can use for drawing and writing
is Microsoft word.
Important Note: In some cases if back up to external server was not possible a folder will be
provided for you to backup you’re backed up database to the Toiohomai server folders.
Report Quality/Presentation.
Your report should be presented in a professional manner meeting the following requirements:
Must have the required cover page and table of contents, with your student name, student ID
and paper code.
Should have sections and be error free.
Marks available:
Directions :
You are required to build two version of this database in SQL server :
A (V1)- Build a database from above ERD diagram using graphical tools of SQL server
and select proper type for each arributes and populate and create diagram .
A(V2)- Build the same databases and their relationship with polulated data using SQL
command ( Create & Instert )
COMP.5205, Database administration Assignment 2
Instructions:
LECTURER SUBJECT
Attribute Name Data Type
LecturerID
LastName
FirstName CLASSROOM
StreetAddress
BUILDING
Suburb
City
Attribute Name Data Type
BuildingID
BuildingName
Building type
Location
A V1- 2) Identify and build all primary keys and foreign keys correctly (4 Marks)
AV1- 3) Identify and choose all attribute types correctly for each tables (4 marks)
AV1- 4) Populate all tables with at least 5 lines of data of your choice appropriately (6 marks)
AV1- 5) Create and save a (schema) diagram for this relational database in SQL server with correctly
created relationship between tables ( 3 Marks)
AV1- 6) Backup and save your database file at given location with proper naming, AV1 Ass2-
Yourname ( 5 marks)
Note: Submit the backup file, and screen shot of the database, including the tables’ relationship
diagram and each table in design view and as populated table
Build a databases and create tables using SQL code to create all four tables with their relationship
and given constraint
A V2- 1) use create command (including constraints) to crate all four tables in the database, save and
submit the SQL file as “Av2-Create-Yourname.sql” file (12 marks = 3 marks for each correct
table creation and its relationships)
A V2- 2) Use insert command to populate all four tables, save and submit the SQL file as “AV2-Insert-
Yourname.sql” (8 marks = 2 marks for each correct table creation and its relation)
AV2- 3) Backup and save your database file in given location with proper naming, AV2- Ass2-
Yourname (5 marks)
Note: Submit the backup file, and attach electronic file saved for written codes. Additionally provide
screen shot of the database, including the tables’ relationship diagram and each table in
“design view” and as “populated table”
B1- Write an SQL statement which returns the first name and last name of the lecturer.
Save the file as B1-SQL [use of select statement] (4 Marks)
B2- Write a SQL statement to return the lecturer surname and subject that lecturer is teaching. Save
the file code as B2-SQL (4 marks)
B3- Write a SQL statement which returns class room id with the highest number of desks. Save the
file code as B3-SQL (4 marks)
B4- Write a SQL statement which indexes your databases according to lecturers ID. Save the file code
as B4-SQL (4 marks)
B5- Write a SQL code which adds a column “Lecturer phone number “to the Lecturer table.
Save the file code as B5-SQL (4 marks)
B6- Write a SQL code to create a view for building name renamed as (B-Name) and building type
returned as (B-Type), and additional code for showing the view you have created.
Save the file code as B6-SQL (4 marks)
B7 – Write a Joint statement that joins “Room-ID” from class room table and “location” from
building table on the “building ID” in class room table is the same as “Building ID” in the Building
table and order the result on “Room – ID” . Save the file code as B7-SQL (4 marks)
Note: You need to submit all SQL electronic file created, as well as you need to write the code as the
answer of each of these sections in your report.
Students are expected to comply with reports professionalism Assigned marks for each
requirements. requirements