Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

# Saving this for later?

### Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Standard text messaging rates apply

# Cis336 all i labs week 1 to week 7 devry university

1,535
views

Published on

Published in: Education, Technology

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
1,535
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
4
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. CIS 336 All iLabs Week 1 to Week 7 Devry UniversityClick this link to get the tutorial:http://homeworkfox.com/tutorials/general-questions/4159/cis-336-all-ilabs-week-1-to-week-7-devry-university/CIS 336 Week 1 iLab 1 Devry UniversityLABOVERVIEWScenario/SummaryThis lab will introduce you to the processes involved in defining one of the key components of adata model; the relationship diagram (RD). In this lab, you will draw a relationship diagram fortwo of the steps shown. Keep in mind when you are trying to decide which side of therelationship should be the "one" side and which should be the "many" that you must first decidewhich side has the primary key, or unique identifier. Once you have decided the primary key ofthe relationship, you have identified the "one" side of the relationship. Note that for an RD, theforeign key "many" side of the relationship points to the primary key "one" side. The "one" sideshould have the arrowhead point of the connecting line. This is different than anentity/relationship diagram (ERD) that we will draw next week, where the "many" side hascrows feet.This will familiarize you with how to set up MS Visio to draw database diagrams. Steps 1 - 3below use the Customer, Order, and Employee tables of a simplified Order Entry database. TheCustomer table records clients who have placed orders. The Order table contains the basic factsabout customer orders. The Employee table contains facts about employees who take orders. Theprimary keys of the tables are CustNo for Customer, EmpNo for Employee, and OrdNo forOrder.The following are the TABLE definitions for the first three tables showing the PRIMARY KEYconstraints.
• 2. TABLE Customer has the following attributesCustNo 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 KEYTABLE Employee has the following attributesEmpNo NUMBER(5)EmpFirstName VARCHAR2(20)EmpLastName VARCHAR2(30)EmpPhone CHAR(15)EmpNo is the PRIMARY KEYTABLE Order has the following attributesOrdNo NUMBER(5)OrdDate DATECustNo NUMBER(5)EmpNo NUMBER(5)OrdNo is the PRIMARY KEYYour task for this lab is to create the required relationship diagram for steps 1 and 2 usingMicrosoft Visio. Step 3 will require you to analyze the scenario given and present your ownresolution to the question. Step 4 is an individual assignment that will introduce you to the groupproject and the process of identifying entities and attributes. When finished with the lab, youshould have a complete diagram using all 5 entities, a written explanation for #3, and two lists(entities and attributes) for Step 4.DeliverablesThe 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 listsof entities and attributes for the Initial Project Exercise (Step 4). You should copy and paste thediagram from MS Visio into a Word document and use this document for Steps 3 and 4.
• 3. LABSTEPSSTEP 1: Drawing your first ER diagram TitleIdentify the foreign key columns in the table structures above and draw a relationship diagramdepicting the relationships between the tables. In the Order table , the CustNo column referencesthe 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 diagramExtend 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 willneed to identify the FOREIGN KEY(s) to complete this problem. When finished you shouldhave a total of 5 tables represented in your diagram for this problem. To copy and paste thediagram into Word, select Edit from the menu and then Copy Diagram. Open a Word documentand use CTRL-V to paste the diagram.TABLE Product has the following attributesProdNo CHAR(8)ProdName VARCHAR2(20)ProdNo is the PRIMARY KEYTABLE OrdLine has the following attributesOrdNo CHAR(8)ProdNo CHAR(8)Qty NUMBER(5)The combination of OrdNo and Prodno is the PRIMARY KEYSTEP 3: Should a NULL be allowed?From examination of the sample data and your current understanding of businesses in whichorders could be placed either in person, over the phone, or over the Internet, determine if itwould 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 whynot?
• 5. date) are recorded in the back room before they are displayed. The new owner wants to knowwhich products the store sells most of and which are the most profitable.The following is some general information about the company and its current processes.The store has 3 cash registers.Between 3 and 7 employees will work at any given time, depending on the time of day and howbusy they are.An employee logs in to the register at the start of a shift and logs out at the end.The name, address, Social Security number and other information is recorded for everyemployee.All employees are paid weekly against an hourly rate which varies depending on their jobdescription.Each sale is identified by a Receipt No. and a timestamp (date and time) and consists of saleitems with a quantity and price recorded for each product.As a convenience for known customers, they offer a local delivery service. Deliveries are onlymade to customers who are registered at the store; walk-ins must record their name, address, andphone number before a delivery can be made to them.John can find the cost of the goods from the accounts system. What John would like to have is apoint of sale system (POS) that records what has been sold to whom, by whom, for how much,and when. Also, he needs to be able to record the delivery trips that are made, who makes thedelivery, how long the delivery takes, and the amount of the sale. There is concern at this pointthat the cost of delivering the sales to customers is not worth the return on investment.Requirements:You have been asked to develop a logical data model for Clapham Specialty Store based on theinformation given to you by John and his staff. Through analysis of the nouns and verbs in thecase study above, you have accumulated the following entity, attribute, and relationshipinformation shown in the table below. The attribute list may not be complete. If you determinethat additional attributes are needed to better define an entity then you should add them.Entities Attributes and Relationships for Clapham Store:EntityAttributesRelationships
• 6. EmployeeID Number, Last Name, First Name, Phone Number, Employee Type IDAn Employee can belong to any one of the three job categories, but can belong to one and onlyone of the three. Employees have names and other contact information.Employee TypeType ID, Description, Hourly Pay RateAn employee can be either a clerk, delivery person, or a supervisor.Register LogRegister Log Number, Register Number, Log In Time, Log Out Time, Employee IDSales are made using a register and can be tracked by the register log number. An employee mustlog into the register before he/she can use it and must log out when finished with a shift at thatregister. An employee may use more than one register during a period of work.RegisterRegister Number, Register Location Description, Register Serial Number The store has 3 registers: One located at the back of the store and two located at the front of thestore; one on the left and one on the right of the entrance.DeliveriesDelivery Number, Employee ID, Sales Receipt Number, Time the Employee Left and Returned Relates to both the employee and the sale entities. This entity will help track deliveries. Anemployee can make many deliveries but a sale is delivered by one and only one employee.LocationLocation ID, Aisle, Side, ShelfRelates to product and identifies one or more areas of the store where products are displayed.
• 7. ProductProduct ID, Name, Package Size, Cost, Quantity on Hand (QOH), Last Purchased Date, ReorderMinimum Identifies the products the store sells. One or more products can be sold per sale. The quantityon hand allows John to determine his inventory levels. The reorder minimum can be used todetermine when the inventory level has reached a reorder point.SaleReceipt Number, Sales Amount, Sale Date- TimeA sale is identified by a single receipt. Sales are:made to one or more Customers but only one customer at a time.made by one or more Register Clerks but only one clerk per sale.recorded on one or more Registers but only one register per sale.delivered by one or more delivery persons but no one sale can be delivered by more than onedelivery person.Sold ItemsReceipt Number, Product ID, Item Price, Quantity SoldSale Item is part of sale and records product sold per sale. Sale item must be able to associatemultiple products sold on a single sales receipt.CustomerCustomer Number, First Name, Last Name, Address, Phone Number
• 8. A customer can be associated with multiple sales, but any one sale is to one and only onecustomer. A sale can occur without a customer registering in the system.Using MS Visio, develop an ERD that meets the following guidelines:Draw the entities with their attributes.Indicate the relationships between the entities using Crows Foot notation. You will need todetermine the cardinality and optionality for each direction of the relationships. Some of theForeign Key relationships are identified in the graph above but not all. Be sure you identify andaccount for all Foreign Key relationships.Add a name (in both directions) to the relationships. Remember, if you can verbalize therelationship in both directions then you probably have a valid relationship.DeliverablesThe deliverable for this lab will be your completed ERD as a single MS Word document usingcopy/paste from the MS Visio application and named "lab2_solutions_yourname".LABSTEPSSTEP 1: Drawing entities and attributes
• 10. should verify that the constraints you have created are valid and define the correct referential anddata integrity constraints asked for. Lastly, you will write SELECT statements to query the tablesand verify the data was populated.Narrative/Case StudyFor this lab, you be working with command-line SQL to build a series of relational tables, usingSQL CREATE statements in a script file format for the Student Database and then populatethose 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 followingcode: 1. The drop table statements listed later in the specifications of this lab. 2. The CREATE TABLE statements required to build the seven (7) tables. 3. The INSERT statements necessary to insert all of the sample data. 4. Seven 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 following threedocuments which can be found in the Doc Sharing tab on the course website: 1. A Relationship Diagram of the database showing in graphical form the 1:M relationships between the tables (336_Lab3_Relationship_Diagram.doc). 2. A Meta Data chart providing information about table names, column names, etc. Be sure to follow this reference exactly when constructing your CREATE TABLE statements (336_Lab3_Data_Dict.xls). 3. A listing of sample data to use when writing the INSERT statements to populate the tables (336_lab3_input_data.doc).The following guidelines are being provided to help assist you in creating your script file: • Create the tables in the order shown in the data dictionary. Use the names for the tables and columns as listed in the Meta Data chart – Do not change them as it will affect your grade. • Creating CONTRAINTS - • Create all constraints as indicated in the data dictionary. • Constraint suffixes must be as follows: • Primary key constraint – PK • Foreign key constraint – FK • Check constraint - CC
• 11. Explicitly name all constraints PRIMARY KEY, FOREIGN KEY, and CHECK constraints toreflect: • TableName_ColumnName_ConstraintSuffix (For example, to name a PRIMARY KEY constraint on the SID column in the student table you would use STUDENT_SID_PK.) • For this lab you do not have to explicitly name NOT NULL constraintsCreate all PRIMARY KEY and NOT NULL constraints within the CREATE TABLE statementsat the column level (line level), unless the Primary Key is a composite Primary Key (yes, there isone). Composite Primary Key constraints must be created at the table level. Create all FOREIGNKEY and CHECK constraints at the table level using ALTER TABLE statements. All constraintsmust be added prior to populating the tables with data. Create all of the tables and all of theconstraints before populating any of the tables with data. Insert statements must be in the sameorder as the tables are created (follow the order in the sample data file). ALL character stringsmust be enclosed in single quotes. This includes alpha strings and alphanumeric (remember thatany formatting within a numeric strings makes it alphanumeric). If you are inserting a NULL, donot enclose the word NULL in single quotes, as this will insert the word NULL into the row. Toinsert a null you simply use the word NULL.DeliverablesThe deliverable for this lab will include the following documents. 1. Your script file. Create this file in Notepad 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 line comment:--Jacob Smith--Lab 3 1. Your lab output file created using a spool session in SQL*Plus.Be sure to use the SET ECHO ON session command when creating the output file so that boththe SQL commands and results will show in the output. Be sure your name is on all documentsand that all documents have been included in a single Zip file for this week’s assignments. LABSTEPSSTEP 1: The DROP statementsThe following DROP TABLE statements must appear at the top of your script file. This willallow you to run and re-run your script file as often as you need to. The first time you run yourscript file you will get an ERROR on the drop statements saying the Table or View does not