SlideShare uma empresa Scribd logo
1 de 5
CIS/336 iLab 1 of 7 - SQL Course

LABOVERVIEW

Scenario/Summary



This lab will introduce you to the processes involved in defining one of the key components of a data
model; the relationship diagram (RD). In this lab, you will draw a relationship diagram for two of the
steps shown. Keep in mind when you are trying to decide which side of the relationship should be
the "one" side and which should be the "many" that you must first decide which side has the
primary key, or unique identifier. Once you have decided the primary key of the relationship, you
have identified the "one" side of the relationship. Note that for an RD, the foreign key "many" side
of the relationship points to the primary key "one" side. The "one" side should have the arrowhead
point of the connecting line. This is different than an entity/relationship diagram (ERD) that we will
draw next week, where the "many" side has crow's feet.



This will familiarize you with how to set up MS Visio to draw database diagrams. Steps 1 - 3 below
use the Customer, Order, and Employee tables of a simplified Order Entry database. The Customer
table records clients who have placed orders. The Order table contains the basic facts about
customer orders. The Employee table contains facts about employees who take orders. The primary
keys of the tables are CustNo for Customer, EmpNo for Employee, and OrdNo for Order.



The following are the TABLE definitions for the first three tables showing the PRIMARY KEY
constraints.

TABLE Customer has the following attributes



CustNo                        NUMBER(5)



CustFirstName              VARCHAR2(20)



CustLastName                VARCHAR2(30)



CustCity                      VARCHAR2(30)



CustState                    CHAR(2)
CustZip                       CHAR(10)



CustBal                       NUMBER(12,2)



CustNo is the              PRIMARY KEY




TABLE Employee has the following attributes



EmpNo                        NUMBER(5)



EmpFirstName              VARCHAR2(20)



EmpLastName                VARCHAR2(30)



EmpPhone                    CHAR(15)



EmpNo is the               PRIMARY KEY




TABLE Order has the following attributes



OrdNo                        NUMBER(5)



OrdDate                      DATE
CustNo                         NUMBER(5)



EmpNo                          NUMBER(5)



OrdNo is the                PRIMARY KEY




Your task for this lab is to create the required relationship diagram for steps 1 and 2 using Microsoft
Visio. Step 3 will require you to analyze the scenario given and present your own resolution to the
question. Step 4 is an individual assignment that will introduce you to the group project and the
process of identifying entities and attributes. When finished with the lab, you should have a
complete diagram using all 5 entities, a written explanation for #3, and two lists (entities and
attributes) for Step 4.

Deliverables

The deliverable for this lab is a single MS Word document named "Lab1_solution_yourname" with
the diagram for problems 1 and 2, the written answer for the question in Step 3, and the lists of
entities and attributes for the Initial Project Exercise (Step 4). You should copy and paste the
diagram from MS Visio into a Word document and use this document for Steps 3 and 4.

LABSTEPS




STEP 1: Drawing your first ER diagram Title

Identify the foreign key columns in the table structures above and draw a relationship diagram
depicting the relationships between the tables. In the Order table , the CustNo column references
the Customer table and the EmpNo column references the Employee table. For each relationship,
identify the table on the "1" side of the relationship and the table on the "Many" side.

STEP 2: Extending the ER diagram

Extend your relationship diagram from problem 1 by adding two tables (OrdLine and Product). Table
definitions for the table structures and primary keys constraints are shown below. You will need to
identify the FOREIGN KEY(s) to complete this problem. When finished you should have a total of 5
tables represented in your diagram for this problem. To copy and paste the diagram into Word,
select Edit from the menu and then Copy Diagram. Open a Word document and use CTRL-V to
paste the diagram.
TABLE Product has the following attributes



ProdNo                                    CHAR(8)



ProdName                     VARCHAR2(20)



ProdNo is the                PRIMARY KEY



TABLE OrdLine has the following attributes



OrdNo                          CHAR(8)



ProdNo                                    CHAR(8)



Qty                              NUMBER(5)



The combination of OrdNo and Prodno is the

PRIMARY KEY



STEP 3: Should a NULL be allowed?

From examination of the sample data and your current understanding of businesses in which orders
could be placed either in person, over the phone, or over the Internet, determine if it would be
permissible for null values to be allowed for the foreign key EmpNo in the Order table. This column
would reference back to the EmpNo column in the employee table. Why or why not?

OrdNo              OrdDate             CustNo              EmpNo



O1656777        02/11/2000            C8543321

O7959898        02/19/2000            C8543321            E8544399



STEP 4: Initial Project Exercise

Although the overall project itself will be done as a group, this first exercise is designed as an
individual effort and is intended to; (1) get you to read the project specifications, and; (2) introduce
you to the first step in designing a database from scratch. This little exercise will have you see how
many entities and attributes you can find in the project specifications. In week three, you will work
with your assigned project team and compare notes on what you have found. This is not rocket
science here so remember, you are looking for people, places, things, and events (entities) and the
attributes that describe them


CLICK HERE TO GET THE SOLUTION !!!!!!!!

Mais conteúdo relacionado

Mais procurados

FINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEMFINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEMAmira Dolce Farhana
 
Normalization by Ashwin and Tanmay
Normalization by Ashwin and TanmayNormalization by Ashwin and Tanmay
Normalization by Ashwin and TanmayAshwin Dinoriya
 
Cis 336 final exam 2
Cis 336 final exam 2Cis 336 final exam 2
Cis 336 final exam 2lifesgood12
 
CIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)sCIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)scritterc07
 
CIS 336 Final Exam 2 (Devry)
CIS 336 Final Exam 2 (Devry) CIS 336 Final Exam 2 (Devry)
CIS 336 Final Exam 2 (Devry) critter03
 
Class x unit test-ii
Class x unit test-iiClass x unit test-ii
Class x unit test-iiSumita Sarkar
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAINSyahriha Ruslan
 
Cs511 data-extraction
Cs511 data-extractionCs511 data-extraction
Cs511 data-extractionBorseshweta
 
Fp304 DATABASE SYSTEM JUNE 2012
Fp304   DATABASE SYSTEM JUNE 2012Fp304   DATABASE SYSTEM JUNE 2012
Fp304 DATABASE SYSTEM JUNE 2012Syahriha Ruslan
 
RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)Muhammad T Q Nafis
 
Lesson Six Entering And Editing Data In Tables
Lesson Six   Entering And Editing Data In TablesLesson Six   Entering And Editing Data In Tables
Lesson Six Entering And Editing Data In Tablesguevarra_2000
 

Mais procurados (14)

FINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEMFINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEM
 
Normalization by Ashwin and Tanmay
Normalization by Ashwin and TanmayNormalization by Ashwin and Tanmay
Normalization by Ashwin and Tanmay
 
Cis 336 final exam 2
Cis 336 final exam 2Cis 336 final exam 2
Cis 336 final exam 2
 
CIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)sCIS 336 Final Exam 2 (Devry)s
CIS 336 Final Exam 2 (Devry)s
 
ch3
ch3ch3
ch3
 
CIS 336 Final Exam 2 (Devry)
CIS 336 Final Exam 2 (Devry) CIS 336 Final Exam 2 (Devry)
CIS 336 Final Exam 2 (Devry)
 
Class x unit test-ii
Class x unit test-iiClass x unit test-ii
Class x unit test-ii
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
 
Cs511 data-extraction
Cs511 data-extractionCs511 data-extraction
Cs511 data-extraction
 
Fp304 DATABASE SYSTEM JUNE 2012
Fp304   DATABASE SYSTEM JUNE 2012Fp304   DATABASE SYSTEM JUNE 2012
Fp304 DATABASE SYSTEM JUNE 2012
 
SQL
SQLSQL
SQL
 
RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)
 
Lesson Six Entering And Editing Data In Tables
Lesson Six   Entering And Editing Data In TablesLesson Six   Entering And Editing Data In Tables
Lesson Six Entering And Editing Data In Tables
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
 

Semelhante a SQL Lab 1 - Relationship Diagram and Null Values

Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1CIS339
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1CIS339
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1jackiechaner
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1CIS339
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1CIS339
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 17Fase1
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityjskdhklsduopuo0980
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCIS339
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityjackiechaner
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university7Fase1
 
Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Massimo Cenci
 
Nunes database
Nunes databaseNunes database
Nunes databaseRohini17
 
CIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.comCIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.comJaseetha16
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorialMohd Tousif
 

Semelhante a SQL Lab 1 - Relationship Diagram and Null Values (20)

Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 week 1 i lab 1
Cis336 week 1 i lab 1Cis336 week 1 i lab 1
Cis336 week 1 i lab 1
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university
 
Cis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry universityCis336 all i labs week 1 to week 7 devry university
Cis336 all i labs week 1 to week 7 devry university
 
Session 6#
Session 6#Session 6#
Session 6#
 
Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3
 
Sql 2006
Sql 2006Sql 2006
Sql 2006
 
Nunes database
Nunes databaseNunes database
Nunes database
 
AQA Computer science easter revision
AQA Computer science easter revisionAQA Computer science easter revision
AQA Computer science easter revision
 
Sap query for task list data extraction
Sap query for task list data extractionSap query for task list data extraction
Sap query for task list data extraction
 
CIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.comCIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.com
 
SQL Reports in Koha
SQL Reports in KohaSQL Reports in Koha
SQL Reports in Koha
 
Oracle sql tutorial
Oracle sql tutorialOracle sql tutorial
Oracle sql tutorial
 

Mais de ashhadiqbal

Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6ashhadiqbal
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6ashhadiqbal
 
Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6ashhadiqbal
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6ashhadiqbal
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6ashhadiqbal
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7ashhadiqbal
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7ashhadiqbal
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7ashhadiqbal
 
Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7ashhadiqbal
 
CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7ashhadiqbal
 
CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7ashhadiqbal
 

Mais de ashhadiqbal (15)

Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6
 
Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6
 
Ilab 2 of 7
Ilab 2 of 7Ilab 2 of 7
Ilab 2 of 7
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7
 
Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7
 
CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7
 
CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7
 
PRG/421 Week 4
PRG/421 Week 4PRG/421 Week 4
PRG/421 Week 4
 
PRG/421 Week 2
PRG/421 Week 2PRG/421 Week 2
PRG/421 Week 2
 
PRG/421 Week 1
PRG/421 Week 1PRG/421 Week 1
PRG/421 Week 1
 

SQL Lab 1 - Relationship Diagram and Null Values

  • 1. CIS/336 iLab 1 of 7 - SQL Course LABOVERVIEW Scenario/Summary This lab will introduce you to the processes involved in defining one of the key components of a data model; the relationship diagram (RD). In this lab, you will draw a relationship diagram for two of the steps shown. Keep in mind when you are trying to decide which side of the relationship should be the "one" side and which should be the "many" that you must first decide which side has the primary key, or unique identifier. Once you have decided the primary key of the relationship, you have identified the "one" side of the relationship. Note that for an RD, the foreign key "many" side of the relationship points to the primary key "one" side. The "one" side should have the arrowhead point of the connecting line. This is different than an entity/relationship diagram (ERD) that we will draw next week, where the "many" side has crow's feet. This will familiarize you with how to set up MS Visio to draw database diagrams. Steps 1 - 3 below use the Customer, Order, and Employee tables of a simplified Order Entry database. The Customer table records clients who have placed orders. The Order table contains the basic facts about customer orders. The Employee table contains facts about employees who take orders. The primary keys of the tables are CustNo for Customer, EmpNo for Employee, and OrdNo for Order. The following are the TABLE definitions for the first three tables showing the PRIMARY KEY constraints. TABLE Customer has the following attributes CustNo NUMBER(5) CustFirstName VARCHAR2(20) CustLastName VARCHAR2(30) CustCity VARCHAR2(30) CustState CHAR(2)
  • 2. CustZip CHAR(10) CustBal NUMBER(12,2) CustNo is the PRIMARY KEY TABLE Employee has the following attributes EmpNo NUMBER(5) EmpFirstName VARCHAR2(20) EmpLastName VARCHAR2(30) EmpPhone CHAR(15) EmpNo is the PRIMARY KEY TABLE Order has the following attributes OrdNo NUMBER(5) OrdDate DATE
  • 3. CustNo NUMBER(5) EmpNo NUMBER(5) OrdNo is the PRIMARY KEY Your task for this lab is to create the required relationship diagram for steps 1 and 2 using Microsoft Visio. Step 3 will require you to analyze the scenario given and present your own resolution to the question. Step 4 is an individual assignment that will introduce you to the group project and the process of identifying entities and attributes. When finished with the lab, you should have a complete diagram using all 5 entities, a written explanation for #3, and two lists (entities and attributes) for Step 4. Deliverables The deliverable for this lab is a single MS Word document named "Lab1_solution_yourname" with the diagram for problems 1 and 2, the written answer for the question in Step 3, and the lists of entities and attributes for the Initial Project Exercise (Step 4). You should copy and paste the diagram from MS Visio into a Word document and use this document for Steps 3 and 4. LABSTEPS STEP 1: Drawing your first ER diagram Title Identify the foreign key columns in the table structures above and draw a relationship diagram depicting the relationships between the tables. In the Order table , the CustNo column references the Customer table and the EmpNo column references the Employee table. For each relationship, identify the table on the "1" side of the relationship and the table on the "Many" side. STEP 2: Extending the ER diagram Extend your relationship diagram from problem 1 by adding two tables (OrdLine and Product). Table definitions for the table structures and primary keys constraints are shown below. You will need to identify the FOREIGN KEY(s) to complete this problem. When finished you should have a total of 5 tables represented in your diagram for this problem. To copy and paste the diagram into Word, select Edit from the menu and then Copy Diagram. Open a Word document and use CTRL-V to paste the diagram.
  • 4. TABLE Product has the following attributes ProdNo CHAR(8) ProdName VARCHAR2(20) ProdNo is the PRIMARY KEY TABLE OrdLine has the following attributes OrdNo CHAR(8) ProdNo CHAR(8) Qty NUMBER(5) The combination of OrdNo and Prodno is the PRIMARY KEY STEP 3: Should a NULL be allowed? From examination of the sample data and your current understanding of businesses in which orders could be placed either in person, over the phone, or over the Internet, determine if it would be permissible for null values to be allowed for the foreign key EmpNo in the Order table. This column would reference back to the EmpNo column in the employee table. Why or why not? OrdNo OrdDate CustNo EmpNo O1656777 02/11/2000 C8543321 O7959898 02/19/2000 C8543321 E8544399 STEP 4: Initial Project Exercise Although the overall project itself will be done as a group, this first exercise is designed as an individual effort and is intended to; (1) get you to read the project specifications, and; (2) introduce
  • 5. you to the first step in designing a database from scratch. This little exercise will have you see how many entities and attributes you can find in the project specifications. In week three, you will work with your assigned project team and compare notes on what you have found. This is not rocket science here so remember, you are looking for people, places, things, and events (entities) and the attributes that describe them CLICK HERE TO GET THE SOLUTION !!!!!!!!