You are on page 1of 4

Page 1 of 4

ASSIGNMENT OF DATABASE

This is an entity- relationship diagram* for “Course_List”, which is a small database


that might be used for a course schedule. For this assignment, you’ll create a fourth table
called “Classroom”, which will contain more information about the classroom locations.

This database consists of three tables, which are described below.

Term, which has three attributes


Term – a term description, like “Spring 1 2011” (and primary key)
Term _Start Date – the actual start date of the term, like “1/18/2011”
Term _End Date – the actual end date of the term, like “3/7/2011”

The data in Term looks like this:

Term Term_StartDate Term_EndDate


Spring 1 2011 1/18/2011 3/7/2011
Spring 2 2011 3/14/2011 5/1/2011
Summer 1 2011 5/10/2011 6/27/2011

Course, which has two attributes


Course_Code – a course identifier, (the primary key)
like “MET CS 200”
Course_Title – the class title,
like “Fundamentals of Information Technology”

The data in Course looks like this:


Course_Code Course_Title
MET CS 200 Fundamentals of Information Technology
MET CS 546 Quantitative Methods for Information Systems
MET CS 625 Business Data Communication and Networks
MET CS 669 Database Design & Implementation for Business
MET CS 682 Information Systems Analysis and Design
Page 2 of 4

Course_List, which has five attributes


ID – An automatically generated number (and primary key)
Course_Code – a section number, like “MET CS 200”
Term – a term description, like “Spring 1 2011”
Instructor – last name of the instructor for the course, like “Tis”
ClassroomCode – a numeric code for the classroom where the class
is held.

The data in Course_List looks like this:

ID Course_Code Term Instructor ClassroomCode


1 MET CS 200 Spring 1 2011 Tis 1
2 MET CS 669 Spring 1 2011 Schudy 2
3 MET CS 682 Spring 2 2011 Braude 1
4 MET CS 625 Spring 2 2011 Chitkushev 2
5 MET CS 546 Summer 1 2011 Temkin 3

Course_List has two foreign keys: Term, which references the primary key in Term, and
Course_Code, which references the primary key in Course.

All questions are equally weighted.

Instructions:

Complete all of the following in a Microsoft Word document:

1. Identify an attribute or combination of attributes in the table Course_List, other


than ID, that would make a suitable primary key. Assume that a course can only
run once in a given term, that instructors may teach multiple courses at the same
time, and that the instructor for any given course may be different in different
terms.

2. Write a SQL CREATE TABLE command to create a table for "Term" as defined
above.

3. Write the SQL INSERT commands to add the data above into your table.

4. Write a SQL CREATE TABLE command to create a table for "Course" as


defined above.

5. Write the SQL INSERT commands to add the data above into your table.

6. Write a SQL CREATE TABLE command to create a table for "Course_List" as


defined above using ID as the primary key.
Page 3 of 4

7. Write the SQL INSERT commands to add the data above into your table.

8. Write a SQL CREATE TABLE command to create a table for “Classroom” that
identifies the classrooms for each Classroom code. This is a new table, not
defined above. Include the following attributes:
a. ClassroomCode(pk)
b. Location
c. Room
d. Campus
Identify an appropriate primary key and write the CONSTRAINT clause as part
of the CREATE TABLE script to define it as a primary key.

9. Do any changes need to be made to your previously defined tables in order to


accommodate the new table "Classroom"? If so, what are they?

10. Write the SQL INSERT commands to add the following data into your new table:

ClassroomCod Location Room Campus


e
1 Corporate Education Center 112 Tewksbury
2 755 Commonwealth Ave 437 Charles River
3 Boulevard du Triomphe, 174, Triomflaan 203 Brussels

11. Write the SQL statement that joins the two tables (Course and Course_List) and
shows the data for these fields:

Course_Code
Course_Title
Instructor
Term

The SQL statement to join the tables (Course and Course list) is as follows:
SELECT COURSE. Course code, COURSE .Course title, COURSE LIST .Course code,
COURSE LIST .Term, COURSE LIST .Instructor, COURSE LIST .Classroom code

FROM COURSE JOIN COURSE LIST on COURSE .Course code=COURSE LIST


.Course code
The data for course code, course title, instructor and term will be

Course Course title Instructor Term


code
Page 4 of 4

MET CS 200 Fundamentals of information technology Tis Spring1 2011


MET CS 669 Database design and implementation for Shudy Spring1 2011
business
MET CS 682 Information system analysis & design Braude Spring2 2011
MET CS 625 Business data communication & networks Chitkushev Spring2 2011
MET CS 546 Quantitative methods of information Temkin Summer1 2011
system

You might also like