This Tutorial was purchased 1 times & rated No rating by student like you.
CIS-336: Lab 3: Building the Physical
Scenario and Summary
The lab for this week addresses taking a logical database design (data model) and transforming it into a
physical model (tables, constraints, and relationships). As part of the lab, you will need to download the
zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test
data for the tables you create as you complete this exercise.
Your job will be to use the ERD Diagram found below as a guide to define the table structures and
constraints using both CREATE TABLE and ALTER TABLE statements. Once this has been done, you will
need to write the INSERT INTO TABLE statements to insert the data provided into the table. The data
should verify that the constraints you have created are valid and define the correct referential and data
integrity constraints asked for. Lastly, you will write SELECT statements to query the tables and verify
the data was populated. Please use exactly the data provided, without addition, deletion, or alteration
except as directed, as your results may be evaluated against expected results generated using this exact
For this lab, you will be creating SQL statements to build a series of relational tables, using SQL CREATE
statements in a script file format for the Student Database. You will then populate those tables through
the use of INSERT statements with sample data.
You will need to create a script file and name it YourName_Lab3.txt containing the following code.
1. The drop table statements listed later in the specifications of this lab.
2. The CREATE TABLE statements required to build the six tables.
3. The INSERT statements necessary to insert all of the sample data.
4. Six select statements to verify that the data is in the tables and accessible.
To help you accomplish this task successfully, you are being supplied with the ERD Diagram which
follows, and the exact data to be inserted into each table, which may be found via the Doc Sharing tab
on the course website.
The following guidelines are being provided to help assist you in creating your script file.
· Use the names for the tables and columns as listed in the ERD. Do not change them as it will
affect your grade.
· Creating Constraints
o Create all NOT NULL constraints as indicated in the ERD.
o Create all PK constraints as indicated in the ERD.
o Create all FK constraints as indicated in the ERD.
· Create all of the tables and all of the constraints before populating any of the tables with data.
· Because FK constraints will be in place when the insert statements are executed, you will need
to consider carefully which tables must be created before others in order to ensure that FK
constraints are not violated.
· The COURSE table has a self-referencing FK constraint. Specifically, some courses have
prerequisite courses. Consequently, the record for a course possessing a prerequisite course
cannot be successfully inserted into the table unless the record for the prerequisite course has
already been inserted. This may require you to reorder the insert statements to resolve FK
violations when loading the table. You may reorder the data provided for this table, but do not
· The data for one table intentionally contains a record containing an FK constraint that is not
resolved by a record in the parent table. This orphaned record has been included as an exercise
for you to find. Because this record has an unreconciled FK constraint, it cannot be successfully
inserted. You will need to delete or comment out the insert statement for this one record in
order to produce a script that runs without errors.
· Aside from reordering the data for the COURSE table as necessary, and commenting
out/deleting the ONE record whose FK dependency cannot be resolved by the data provided,
you are NOT to modify, add to, or delete from the data provided. Your SQL script must produce
tables containing data identical to the expected solution set, or points will be deducted.
· ALL character strings must be enclosed in single quotes. This includes alpha strings and
alphanumeric (remember that any formatting within a numeric string makes it alphanumeric).
· If you are inserting a NULL, do not enclose the word NULL in single quotes, as this will insert the
word NULL into the row. To insert a null you simply use the word NULL.
The deliverable for this lab will include the following documents.
1. Your script file. Create this file in Notepad, or another PURE TEXT editor—NOT Word. Make sure
your name is in a comment area at the top of the script file. Use a double dash to create a one-
2. Your script file must execute without error. It is recommended that you begin early in the week,
and post any questions to the Q & A discussion in order to produce a working script by the due
Be sure your name is on all documents and that all documents have been included in a single zip file for
this week’s assignments.
Refer to the following ERD in constructing your solution.
STEP 1: The DROP Statements
A DROP TABLE statement must appear in your script file, prior to the SQL statements for creating
the table in question. This will allow you to run and re-run your script file as often as you need to. The
very first time you run your script the table does not exist, so the IF EXISTS clause causes the statement
to be ignored. Thereafter, the table will be deleted, ensuring that your CREATE TABLE statement creates
the table fresh and clean, with only the attributes present in the current revision of the CREATE
statement. Here is an example of one of the six DROP TABLE statements you will need to create.
DROP TABLE IF EXISTS `ENROLLMENT` ;
STEP 2: The CREATE TABLE Statements
Next, define the CREATE TABLE statements for the six tables that you are to create based upon the
ERD (provided above) for this lab. Be sure to follow the guidelines given above on how and where to
create the different types of constraints for each table. This will include PK, FK, and NOT NULL
STEP 3: The INSERT Statements for the Data
The third step is to create the insert statements to insert the sample data into the tables created in
Step 2. The data for each table is contained in text files, named for the table whose data it contains.
Modify the format of the data (e.g., date formats and add or eliminate quote marks) as needed to craft
your insert statements, but do not change the inherent value of the data.
STEP 4: The SELECT Statements
The next step of the lab will be to create the select statements to verify the data was inserted
correctly. You should have six select statements; one for each table. The command is SELECT * FROM
Table_Name; For example, to select all columns from the Student table, the command would be
SELECT * FROM student;
Be sure to save all of the above statements in your script file.
STEP 5: Testing and Verifying Your Script
Now we come to the point of verifying that your script file works by creating all of the tables and
inserting and selecting all of the data. Your script should execute without errors, and select the entire
contents of each table in turn. Inspect your query results to ensure that each column and row from
each of the tables is as expected. Correct and repeat testing of your script until no errors occur, and the
results match expectations. You may also use the DESCRIBE command to display the table structure of
each table, and verify that PK and NULL constraints have been properly created. The SHOW CREATE
TABLE statement is useful for displaying the SQL that would regenerate a given table, which is a useful
way for checking that FKs have been properly created.
SHOW CREATE TABLE STUDENT;
This is the end of Lab 3
(TCO 6) Which of the following keywords is used to remove a row in a table? (TCO 6) When using the ALTER TABLE...DROP COLUMN command, which of the following is NOT correct? (TCO 6) Which of the following commands will add a new column named FIRSTORDERDATE to the CUSTOMERS table to store t..
(TCO 8) If a Cartesian join is used to link table A which contains five rows to table B which contains eight rows, there will be _______ rows in the results. (TCO 8) Which of the following statements will produce the value 21.1? (TCO 8) Which of the following format elements will display ..
(TCO 7) Which of the following types of columns will automatically right-align the data when it is displayed? (TCO 7) Which of the following SQL statements will display the profit generated by each book currently stored in the BOOKS table? (You do not need to see the table structure for this ..
(TCO 2) Explain what a composite attribute is (TCO 1) Data constitutes the building blocks of (TCO 1) Successful database design is first and foremost based on _____________ requirements. (TCO 1) The lowest level in a database hierarchy is the ____________ or value as it is often refe..
(TCO 3) Normalization works through a series of stages called normal forms. Typically _________ stages must be completed before a table can be considered normalized. (TCO 3) The conflicts between design efficiency, information requirements, and processing speed are often resolved through ..
CIS 336 Final Exam 4 Sets of Answers ..
1. (TCO 7) For every order, list the order number, order date, part number, part description, and item class for each part that makes up the order. 2. (TCO 8) Write a query that will display the customer number, last name, and first name for every customer I whose first name begins with the l..
1. (TCO 2) Explain what physical independence means. (Points : 15) 2. (TCO 8) Sally wants to query the EMP table and determine how many of the employees live in each of the cities the company has factories in. She writes the following query but it does not work. What is wrong with the way the..
1. (TCO 1) Most DBMS are referred to as _____________database management systems. (Points : 4) elemental linked hierarchical relational 2. (TCO 1) A relational DBMS provides protection of the _______________________ through security, control, and recovery facilities. (Points : 4) ..
1. (TCO 1) Most DBMS are referred to as _____________database management systems. (Points : 4) elemental linked hierarchical relational 2. (TCO 1) Data constitutes the building blocks of _____________. (Points : 4) information processing applications programming 3. (TC..
CIS-336: Lab7: Working with Views LAB OVERVIEW Lab 7 will introduce the concept of database views. This lab may be completed using either DeVry’sOmnymbus EDUPE-APP lab environment, or a local copy of the MySQL database running on your own computer using the OM database tables. The lab will ..
CIS 336 Week 6 Quiz Question 1. (TCO 6) Which of the following keywords can be used to change the size, datatype, or default value of an existing column? ..
CIS336: Lab 6: Group Functions and Subqueries LAB OVERVIEW Scenario and Summary Lab 6 will introduce the concept of group functions and subqueries to meet more complex report requirements. This lab may be completed using either DeVry’sOmnymbus EDUPE-APP lab environment, or a local copy of..
CIS 336 Week 5 Quiz Question 1. (TCO 8) The ____ set operator in SQL combines rows from two queries and returns only the values that are common between the tw..
CIS336: Lab5: Joining Tables LAB OVERVIEW Scenario and Summary Lab 5 will introduce the concept of multi-table JOINS in order to work with data in two or more related tables simultaneously. This lab may be completed using either DeVry’sOmnymbus EDUPE-APP lab environment, or a local copy o..
CIS 336 Week 4 Quiz Question 1. (TCO 7) Which of the following types of columns will automatically right-align the data when it is displayed? &..
CIS 336 iLab 4 Introduction to Select, Insert, Update, and Delete Statements (only SQL Command, No output)
CIS336: Lab 4: Introduction to Select, Insert, Update, and Delete Statements LAB OVERVIEW Lab 4 will introduce the various aspects of the SQL select statement and the methods of retrieving data from the database tables. This lab will also introduce the fundamentals of updating and deleting ..
CIS 336 Week 3 Quiz Question 1. (TCO 3) When designing a database, you should _____ Question 2.  ..
CIS 336 Week 2 Quiz  ..
CIS336 Lab 2: The Expanded Entity Relationship Diagram LAB OVERVIEW Scenario and Summary This lab introduces the next step in creating a data model, the Entity Relationship Diagram (ERD). You will be given a business scenario for a University Medical Center, which is a small community hos..
CIS336 Lab 1: Normal Forms and Entity Relationship Diagrams Introduction In this exercise, you will analyze a de-normalized data set presented in the form of a spreadsheet. You will next construct a series of dependency diagrams, transforming the evolving data model from First Normal Form (..
This project is designed to touch all aspects of the fundamental concepts of database design and logical data modeling covered during the class. Each student will be responsible for designing, developing, and demonstrating the functionality of a database created based on a set of business specifi..
CIS 336 Final Exam Question 1. 1. (TCO 1) A DBMS performs several important functions that guarantee the integrity and consistency of the data in the database. Which of the following is NOT one of those functions? Question 2. 2. (TCO 1) A relational DBMS p..