44
CIS 336 Full Course NEW Click Link Below To Buy: http://hwcampus.com/shop/cis-336-full-course-new/ Or Visit www.hwcampus.com CIS 336 Entire Course Introduction to Database w/Lab DeVry NEW CIS 336 Course Project DeVry Objective 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 specifications that you create. At the end of the session, each student will submit a report that includes the logical and physical design of the database and demonstrates the database’s ability to deliver meaningful reports. All aspects of the project will be covered during the week or weeks prior to a deliverable, and each task deliverable in the project will be supported through the exercises and labs done in the course.

Cis 336 full course new

Embed Size (px)

Citation preview

Page 1: Cis 336 full course   new

CIS 336 Full Course NEW

Click Link Below To Buy:

http://hwcampus.com/shop/cis-336-full-course-new/

Or Visit www.hwcampus.com

CIS 336 Entire Course Introduction to Database w/Lab DeVry NEW

CIS 336 Course Project DeVry

Objective

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 specifications that you create. At the end of the session, each student will submit a report that includes the logical and physical design of the database and demonstrates the database’s ability to deliver meaningful reports. All aspects of the project will be covered during the week or weeks prior to a deliverable, and each task deliverable in the project will be supported through the exercises and labs done in the course.

Guidelines

You will create a proposal for a commerce business of your choosing. This can be an actual or fictional business that sells products and/or services. You will determine the business rules and report requirements. Entities that must be included in your model are the following.

Customer

Product (or Service)

Page 2: Cis 336 full course   new

Order

Project Deliverables

This task is broken down into four deliverables.

Task 0 (due at the end of Week 1) Task 1 (due at the end of Week 3) Task 2 (due at the end of Week 5) Task 3 (due at the end of Week 7)

Remember that this is a work in progress and in all likelihood, you will have to make numerous changes to your tables and schema as you go along. These changes are to be expected and are a normal part of the database design and implementation process.

Please refer to the sections below for details regarding deliverables for each task.

Task 0 (due at the end of Week 1)

The first task is to create your business narrative. Some of the questions that you should address include (but are not limited to) the following.

What is the name of your business? Who will be the users of the system (managers, employees, customers)? What product(s) and or service(s) does it sell? Be specific. Who are the customers? What is the customer base? What sales and distribution channels are used? How are payments made? Are products delivered or shipped to customers in some way? Are sales reps involved? Are they paid on commission? What type of reports are needed by the business?

Please include as much detail as possible in order to provide a foundation for Task 1. Submit your proposal as a Word document. Note that this proposal may be revised in the coming weeks as your understanding of the database modeling process grows.

Preview Week 1

“Kitoko Fashions” is online retailer store for boutique clothing products. Usually textile factories create extra items for every order and these remaining items are either discarded or recycled. We purchase these extra items from…

Task 1 (due at the end of Week 3)

Page 3: Cis 336 full course   new

Develop a detailed logical model of your database based on your business scenario submitted for Task 0. Your data model will include an entity-relationship diagram (ERD) developed with Microsoft Visio or MySQL and a data dictionary (DD) developed with Microsoft Excel.

Note that your deliverables each week include any revisions to the previous task.

Submit your Task 1 deliverable as a zip file including the following.

Task 0 proposal (with any revisions or updates) Your ERD copied to a Word document that fits on a single 8 x 10 page Your DD (Excel file)

Preview Week 3

… System Users

Following are system users:

Managers, checking reports for sales, inventory etc. Employees, receiving orders and adding shipment details Customers, placing order from online website

Products

Following are major product categories:

Men’s wear o Teeso Jacketso Denim

Women’s wear o Teeso Jacketso Sleepwearo Denim

Kids & Teens o Teeso Infants….

Task 2 (due at the end of Week 5)

First, make sure to make any necessary revisions to your logical model based on Task 1 feedback. Using MySQL, write the statements to develop a physical model of your database by creating the tables and constraints based on your Task 1 logical model. Be sure to use your ERD and data dictionary and create all constraints appropriately.

Page 4: Cis 336 full course   new

Once your tables are created, you will populate them with data using MySQL statements to insert records into the database. You should insert a minimum of five records into each table and more where necessary to ensure that the data in the database is sufficient to allow for each of your reports to be tested.

The result will be a script file that includes statements to

DROP all tables; CREATE all tables with constraints; INSERT data into all tables; and SELECT data from all tables to show the data in each table.

Name this file yourname_task2.txt.

Also create a Word document that shows the structure of each table and the data in each of your tables (copy and paste from MySQL). Name this file yourname_tables.docx.

Note that your deliverables each week include any revisions to a previous task.

Submit your Task 2 deliverable as a zip file including the following.

Task 0 proposal (with any revisions) Your Task 1 ERD (with any revisions) Your Task 1 DD (with any revisions) Your Task 2 script file to create and populate tables (yourname_task2.txt) A Word document showing all tables and data (yourname_tables.docx)

Preview Week 5

…INSERT INTO WareHouse(WareHouseName,`WareHouseDescription`,`City`,`State`,`Zip`) VALUES

(‘eTextile -1′,’eTextile products warehouse’,’New York’, ‘NY’, 10012),

(‘eTextile -2′,’eTextile products warehouse’,’New Jersy’, ‘NJ’, 10011),

(‘eTextile -3′,’eTextile products warehouse’,’New York’, ‘NY’, 10013),

(‘eTextile -4′,’eTextile products warehouse’,’New York’, ‘NJ’, 10015),

(‘eTextile -5′,’eTextile products warehouse’,’New York’, ‘NY’, 10016);

INSERT INTO Supplier(`SupplierName`,`Address`,`City`,`State`,`Zip`,`SSN`,`ContactPerson`,`PhoneNumber`) VALUES

Page 5: Cis 336 full course   new

(‘Outfitters’, ‘1 Mall’, ‘California’, ‘CA’, 100, ‘018-01-001’, ‘Jhon, Berry’, ‘(101) 21 11345’),

(‘He&She’, ‘212 Downing Street’, ‘New York’, ‘NY’, 101, ‘1-1-1’, ‘Alex, Bonita’, ‘(101) 21 11345’),…

Task 3 (due at the end of Week 7)

Your final task is to use your tables for an update and for reports. There are two requirements.

1. You will demonstrate an update that includes two tables and uses a subquery. Make sure to prove that your update executed correctly by showing data in the tables before and after the update.

2. You will also develop at least four meaningful reports. One must include a join, one must use a subquery, and one must use an aggregate function. You need to describe the business requirement of the update and each report. Note that numeric PK values are not often meaningful to a person looking at the report.

You will create a script file that has each of the queries called yourname_task3.txt. You will also document the results of this task in a Word document called yourname_reports.docx to show the result of each query. For the update and each report,

o describe the update and report requirement;o show the query; ando show the result of the query.

Include a final section for Conclusions and Lessons Learned regarding the project.

Note that your deliverables each week include any revisions to a previous task.

Submit your Task 3 deliverable as a zip file including the following.

o Task 0 proposal (with any revisions)o Your Task 1 ERD (with any revisions)o Your Task 1 DD (with any revisions)o Your Task 2 script file to create and populate tables (with any revisions)o A Word document showing all tables and data (with any revisions)o Your Task 3 script file with update and reports (yourname_task3.txt)o A Word file with results of Task 3 and lessons learned (yourname_reports.docx)

Preview Week 7

… Report requirement

Low stock report will check for the product which are low in stock so that can contact suppliers for more products. Show product detail, warehouse information and supplier details.

Page 6: Cis 336 full course   new

Query

SELECT p.ProductName AS ‘Product’,p.ProductDescription AS ‘Description’, pc.CategoryName AS ‘Category’, ps.QuantityInStock AS ‘Quantity In Stock’, SupplierName as ‘Supplier’, ContactPerson as ‘Contact Person’, PhoneNumber as ‘Phone’, wh.WareHouseName AS ‘Warehouse’

FROM ProductStock ps

INNER JOIN Product p ON p.ProductID = ps.ProductID

LEFT JOIN WareHouse wh on ps.WareHouseNumber = wh.WareHouseNumber….

Grading Rubrics

Task Points Description 0  10  Business narrative includes enough information to build a data model

1  30  ERD and DD that are a representation of the business narrative and are in agreement with each other

2  30  Successful creation of tables and constraints as specified by ERD and DD with adequate data inserted to demonstrate entity and referential integrity

 3  50  Successful update and meaningful reports generated by queriesTotal  120  A quality project will meet or exceed all of the above requirements.

CIS 336 iLab Week 1-7 DeVry

CIS 336 iLab Week 1 DeVry

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 (1NF), to Second Normal Form (2NF), and finally to Third Normal Form (3NF). When the model has reached 3NF, you will construct the Entity Relationship Diagram (ERD) depicting the logical design of the database. Your ERD will use Crow’s Foot notation to denote the relationships between tables.

Sample Exercise, With Solution

Before completing your lab, please review this example problem. The diagram below is a partial depiction of a business spreadsheet for a retail store operation. The store sells books. Books have a 13-digit International Standard Book Number (ISBN), a title, a publisher, and a unit price. Invoices track sales of books. An Invoice contains one or many line items, with each line item reflecting the sale of one or more copies of a specific book. Every publisher has a company name, and a publisher code.

Page 7: Cis 336 full course   new

InvNum ISBN13 InvDat

e BookTitle PubCode PubName Qt

yunitPrice

1022 9781291940336

2015-03-09 MYSQL Functions 1001 Lulu.com 3 4.99

1022 9780321833877

2015-03-09 MySQL, Fifth Edition 1029 Addison-Wesley 5 33.95

1022 9781890774820

2015-03-09

Murach’s MySQL, 2nd Edition 1032 Murach, Mike &

Associates, Inc 2 48.95

 CIS 336 iLab Week 2 DeVry

LAB OVERVIEW The Expanded Entity Relationship Diagram

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 hospital. The business specifications will outline a number of things about the business, some of which will apply directly to the database you are being asked to model. There is a table that lists the entities (tables) that will be needed for the database and related attributes (columns) for each entity. There is also a column that lists specific information about the entity that will be helpful in determining its relationship to other entities within the model.

Be sure to include the minimum and maximum occurrences of each relationship (cardinality) and to supply a name to the relationship that will work in both directions. Make sure to use Crow’s Feet notation in your ERD.

Narrative/Case Study

The University Medical Center is a small, community hospital. A new hospital administrator has recently been hired by the Board of Directors, and directed to right-size patient care and pharmacy services and improve profitability. The hospital operates three clinical facilities: the main hospital, a mid-town clinic, and an Urgent Care location. The hospital also offers selected in-home care services. Many of the patients are repeat or regular patients who receive regular treatment for various conditions, and many utilize the hospital’s pharmacy services for prescription medications.

The pharmacy dispenses about 3,000 different prescription medications of various kinds. Every prescription is associated with one patient, and is logged by the dispensing clinic. The new administrator wants to know which drugs are most prescribed, and also which are the most profitable.

The following is some general information about the organization and its current processes.

The hospital operates three clinical facilities. A healthcare worker logs in at a facility at the start of a shift and logs out at the end.

Page 8: Cis 336 full course   new

The name, address, Social Security number and other information is recorded for every healthcare worker.

All healthcare workers have one billing rate, which is determined by their job description. Each medication dispensed by prescription is linked to both the prescription number and

the medication ID number, recording the item price and the quantity dispensed.

As a convenient and affordable means of providing hospice care, palliative care, and convalescent care to patients that need occasional/intermittent skilled nursing, but do not require hospitalization, the hospital offers limited in-home care. Recording of in-home care includes the healthcare worker ID, their departure time and return time, and also the prescription ID for any prescriptions administered by the healthcare worker in the home setting….

CIS 336 iLab Week 3 DeVry

LAB OVERVIEW Building the Physical Model

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 data set.

Narrative/Case Study

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.

Page 9: Cis 336 full course   new

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 alter it.

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. …

CIS 336 iLab Week 4 DeVry

Scenario/Summary Building the Physical Model

Lab 4 will introduce the various aspects of the SQL SELECT statement and the methods of retrieving data from the database tables. The lab will utilize a database with a set of tables that

Page 10: Cis 336 full course   new

you will create and populate using the instructions and script file found below. These tables will be used for the remaining labs in this class.

STEP 1:  Create the Database and Tables

Create the database and tables (that will be used in labs 4–7) by downloading the following files.

CreateOMTables.docx (Instructions)  create_OM_db.sql (Database Script) 

STEP 2: Download the Week 4 Lab Instructions and Answer Sheet

Follow the instructions to complete the lab by downloading the following files.

Be sure to refer to the ERD for the database in OM_ERD.docx when creating your queries.

STEP 3: Submit Your Answer sheet

Complete the Answer Sheet to show your queries and results and submit according to the lab instructions.

CIS 336 iLab Week 5 DeVry

Retreiving Data From Multiple Tables

Lab 5 deals with writing queries using multiple tables as covered in the reading and lecture material this week. In some cases, you will be given the option to choose the JOIN syntax to use, in other cases, you will be asked to take a specific approach. Using the incorrect process when the process is specified will result in points being taken off for that problem.

This lab will utilize the tables that were created in Lab 4. If you have not yet created these tables,you can create the database and tables (used in labs 4–7) by downloading the following files.

CreateOMTables.docx (Instructions)

create_OM_db.sql (Database Script)

Follow the instructions to complete the lab by downloading the following files.

CIS336Lab5_Instructions.docx 

CIS336Lab5_StudentAnswerSheet.docx 

Page 11: Cis 336 full course   new

Be sure to refer to the ERD for the database in OM_ERD.docx when creating your queries.

CIS 336 iLab Week 6 DeVry

Group Functions and Subqueries

Lab 6 will introduce group or aggregate functions and subqueries. Make sure to follow the instructions provided by each step.

The Student Answer Sheet file that you will download below provides a place for each query and the output of the query. You will copy and paste this information from your MySQL environment.

This lab will utilize the tables that were created in Lab 4. If you have not yet created these tables, you can create the database and tables (used in labs 4–7) by downloading the following files.

CreateOMTables.docx (Instructions)

create_OM_db.sql (Database Script)

Follow the instructions to complete the lab by downloading the following files.

CIS336Lab6_Instructions.docx 

CIS336Lab6_StudentAnswerSheet.docx 

Be sure to refer to the ERD for the database in OM_ERD.docx when creating your queries.

CIS 336 iLab Week 7 DeVry

Working With Views

There is a lot more to a database than just tables and the data in them. A very important part of database security has to do with using and understanding Database Views. Lab 7 will introduce this concept. Make sure to follow the instructions provided in the Lab instructions.

The Student Answer Sheet file that you will download below provides a place for the answer to each problem.  You will copy and paste this information from your MySQL environment. Be sure your name, course number, and lab number are in your file which will be submitted to the iLab Dropbox for Week 7.

This lab will utilize the tables that were created in Lab 4. If you have not yet created these tables,you can create the database and tables (used in Labs 4–7) by downloading the following files.

Page 12: Cis 336 full course   new

CIS 336 Quiz Week 2 DeVry

(TCO 2) Which statement is FALSE regarding a primary key?

Only parent tables must have a primary key.

The values must be unique.

It can be made up of multiple attributes.

The value cannot be NULL.

(TCO 2) _____ integrity ensures that all primary key values are unique and no part of a primary key may be null.

Referential

Entity

Data

Logical

(TCO 2) A(n) _____ in a business rule usually translates to an entity in the data model.

Noun

Verb

Adjective

Adverb

(TCO 4) A(n) ____ provides a detailed description of all attributes in the ERD including their datatypes.

Entity relationship diagram

Data dictionary

Business rule

Pseudocode

Page 13: Cis 336 full course   new

(TCO 2) A _____ primary key is often used in an associative or linking table.

Composite

Foreign

Bridge

Linking

(TCO 4) In the figure below, the OrderLineItems entity is there to implement what type of relationship between Orders and Products?

One to one

One to many

Many to many

No relationship

(TCO 2) When designing a database, you should _____.

Make sure entities are in normal form before table structures are created

Create table structures then normalize the database

Only normalize the database when performance problems occur

Consider more important issues, such as performance, before normalizing

(TCO 2) The term first normal form (1NF) describes the tabular format in which all of the following are true except ______.

All of the key attributes are defined

There are no repeating groups in the table

All attributes are dependent on the primary key

No attributes are dependent on the primary key

(TCO 2) A table is not in 1NF if _____.

It has a primary key defined

Page 14: Cis 336 full course   new

All of the key attributes are defined

There are repeating groups in the table

All attributes are dependent on the primary key

(TCO 2) A _____ data model describes the entities and attributes in as much detail as possible without concern for the implementation details.

Logical

Physical

Conceptual

Network

CIS 336 Quiz Week 3 DeVry

(TCO 3) The _____ column attribute is used to indicate that a value is required for this field.

DEFAULT

AUTO_INCREMENT

REQUIRED

NOT NULL

(TCO 5) The _____ keyword is used in an ALTER statement to add a new column to an existing table.

MODIFY

ADD

INSERT

DROP

(TCO 3) All of the following values can be stored in a column that’s defined as DECIMAL(6,2) except _____.

-245.88

Page 15: Cis 336 full course   new

0

4532.99

24568.02

(TCO 3) The DATETIME data type in MySQL can store _____.

Dates only

Times only

Dates and times

None of the above

(TCO 3) What constraint can only be applied at table level or with an ALTER statement?

Foreign key

Not null

Single field primary key

Composite primary key

(TCO 3) When you build a script for creating tables in a database, _____.

The order that you create the tables does not matter

The order that you create the tables does not matter

You must create parent tables before child tables

You must create parent tables before child tables

(TCO 3) You are creating a table called Department, with fields for the primary key DeptID (Integer) and department name (VARCHAR). What (if anything) is wrong with the following code?

CREATE TABLE Department(deptID INTEGER  Primary Key,deptName VARCHAR(10) NOT NULL,);

Page 16: Cis 336 full course   new

You must use curly braces, not parentheses.

The comma after NOT NULL must be removed.

The keywords cannot be in upper case.

Nothing is wrong.

(TCO 3) What data type is best to store the state abbreviations such as CA?

INTEGER

VARCHAR

DECIMAL

CHAR

(TCO 5) Which statement will add a new column named ORDERDATE to the CUSTOMERS table?

CREATE COLUMN orderdate, DATE ADD to customers;

ALTER TABLE customers ADD COLUMN orderdate DATE;

ALTER TABLE customers ADD orderdate DATE;

MODIFY TABLE customers ADD orderdate DATE;

(TCO 8) When you write an INSERT statement with a column list, which columns can be omitted from the column list?

AUTO_INCREMENT only

DEFAULT only

NOT NULL only

AUTO_INCREMENT, DEFAULT, and fields that allow NULL

CIS 336 Quiz Week 4 DeVry

(TCO 6) The four main clauses of the SELECT statement must be coded in the following order.

SELECT, FROM, ORDER BY, WHERE

Page 17: Cis 336 full course   new

SELECT, WHERE, ORDER BY, FROM

SELECT, FROM, WHERE, ORDER BY

SELECT, ORDER BY, FROM, WHERE

(TCO 6) Which operator would be most appropriate to determine books with a retail price in the range of $50 to $100?

LIKE

IN

Between

>

(TCO 6) Which code returns the date field HIREDATE in the format: Friday, April 5th, 2015?

DATE_FORMAT(HIREDATE, ‘%W, %m %d, %Y’)

DATE_FORMAT(HIREDATE, ‘%a, %M %D, %Y’)

DATE_FORMAT(HIREDATE, ‘%W, %M %D, %Y’)

DATE_FORMAT(HIREDATE, ‘%a, %m %d, %y’)

(TCO 6) Given a books table with fields for title, retail and cost, which of the following will display the new retail price of each book as 20% more than its current retail price along with a heading?

SELECT title, retail * 1.2 AS “New Price” FROM books;

SELECT title, retail + 1.2 AS “New Price” FROM books;

SELECT title, retail * 0.2 AS “New Price” FROM books;

SELECT title, retail * 1.02 AS “New Price” FROM books;

(TCO 8) The column to be updated by the UPDATE command is specified in the _____ clause.

WHERE

MODIFY

Page 18: Cis 336 full course   new

ALTER

SET

(TCO 6) Given a table orders with fields for orderid, orderdate, and shipdate, which query will display the ordered for only those orders that have not shipped?

SELECT orderid FROM orders WHERE shipdate  =  orderdate;

SELECT orderid FROM orders WHERE shipdate IS NOT NULL;

SELECT orderid FROM orders WHERE shipdate IS NULL;

SELECT orderid FROM orders;

(TCO 6) Which WHERE clause will return data on all employees whose last name starts with ‘Smith’?

WHERE lastname LIKE ‘Smith

WHERE lastname LIKE ‘Smith%’

WHERE lastname LIKE ‘%Smith%’

WHERE lastname LIKE ‘%Smith

(TCO 6) Given a books table with fields of title, cost, and retail, what if anything is wrong with the following query (assuming all fields exist)?

SELECT * FROM books ORDER BY retail WHERE cost > 20;

You must sort and filter on the same field.

You cannot use ORDER BY and WHERE in the same query.

The ORDER BY clause must always be last.

Nothing is wrong.

(TCO 8) You can delete one or more rows in a table by using the _____ command.

UPDATE

DROP

DELETE

Page 19: Cis 336 full course   new

ALTER

(TCO 6) Given a books table with fields: title, category (such as ‘SPORTS’), cost, retail;  what condition will return ‘COMPUTER’ books with a retail price between $50 and $100 ?

WHERE retail >  50 AND  < 100 AND category = ‘COMPUTER’

WHERE category = ‘COMPUTER’ AND  (retail BETWEEN 100 and 50)

WHERE category = ‘COMPUTER’ AND  retail < 50  AND retail > 100

WHERE category = ‘COMPUTER’ AND ( retail BETWEEN 50 AND  100)

CIS 336 Quiz Week 5 DeVry

(TCO 7) The _____ condition is generally composed of an equality comparison between the primary key and foreign key of related tables.

Select

View

Join

From

(TCO 7) If Table A, which contains five rows is joined to Table B, which has eight rows without a valid join condition, the resulting cartesian product would have _____ rows.

Five

Eight

13

40

(TCO 7) Given the two tables described below, which of the following JOIN queries (if any) is not correct?customer:   customerid(PK), lastname, firstnameorder:  orderid(PK), orderdate, customerid(FK)

SELECT lastname, orderdate from customer JOIN order ON customer.customerid = order.customerid;

SELECT lastname, orderdate from customer JOIN order USING (customerid);

Page 20: Cis 336 full course   new

SELECT lastname, orderdate from customer, order WHERE customer.customerid = order.customerid;

All of the above

(TCO 7) In a join, column names need to be qualified only

In inner joins

In outer joins

When the code is confusing

When the same column names exist in both tables

(TCO 7) A left join returns

Rows in the left table that don’t satisfy the join condition

Unmatched rows from both the left and right tables

Rows in the right table that don’t satisfy the join condition

The Cartesian product of the two tables

(TCO 7) Which statement is NOT true about the USING keyword?

You use it to simplify the syntax for joining tables

The ON clause must also be used along with the USING clause

It can be used with inner or outer joins

The join will use the equals operator to compare the two columns

(TCO 7) Consider the ERD below. How many tables would be required to create a query to display the customer first and last name along with orderdate of each order they placed?

One

Two

Three

Four

Page 21: Cis 336 full course   new

(TCO 7) Consider the ERD below. Which query will return the first and last name of each customer whose order was placed after January 1, 2014?

SELECT firstname, lastname from customer, order WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer JOIN  order WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer JOIN order USING (customerID) WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer WHERE orderdate > ‘2014-01-01’

(TCO 7) Consider the ERD below. What query will return the orderid and date of any orders with products having a price more than $50?

SELECT orderID, orderdate from order JOIN OrderLine JOIN Product WHERE price > 50;

SELECT orderID, orderdate from order, OrderLine, Product WHERE price > 50;

SELECT orderID, orderdate from order JOIN OrderLine ON order.orderID = OrderLine.orderID JOIN Product ON OrderLine.productID = Product.productID WHERE price > 50;

SELECT orderID, orderdate from order JOIN OrderLine ON order.orderID = OrderLine.orderID WHERE price > 50;

(TCO 7) Consider the ERD below. Note that there are some products produced in-house that do not require a vendor, thus their vendorID is NULL. Also note that not all vendors currently supply products.  Which query would be used to generate a report showing vendorname and productname, and will include ALL products even if they do not currently have a vendor?

SELECT vendorname, productname FROM vendor LEFT JOIN product;

SELECT vendorname, productname FROM vendor RIGHT JOIN product;

SELECT vendorname, productname FROM vendor LEFT JOIN product ON vendor.vendorID = product.vendorID;

SELECT vendorname, productname FROM vendor RIGHT JOIN product ON vendor.vendorID = product.vendorID;

CIS 336 Quiz Week 6 DeVry

(TCO 7) Which is an aggregate function?

TRUNCATE

Page 22: Cis 336 full course   new

MAX

FLOOR

ROUND

(TCO 7) Which of the following statements is correct?

WHERE operates on groups formed by aggregate functions and HAVING operates on individual rows

WHERE can only be used along with HAVING

HAVING can only be used along with WHERE

WHERE operates on individual rows and HAVING operates on groups formed by aggregate functions

(TCO 7) Given the books table described below, which of the following will display each category along with the average price of books in that category?books:   bookid(PK), ISBN, title, pubdate, cost, retail, category, pubid(FK)

SELECT category, AVG(retail) FROM books;

SELECT AVG(retail) FROM books GROUP BY category;

SELECT category, AVG(retail) FROM books GROUP BY category;

SELECT category, AVG(retail) FROM books GROUP BY category, retail;

(TCO 7) Given the books table described below, which of the following will list the title(s) of books with the earliest publication date?books:   bookid(PK), ISBN, title, pubdate, cost, retail, category, pubid(FK)

SELECT title FROM books WHERE pubdate = MIN(pubdate);

SELECT title , MIN(pubdate) FROM books

SELECT title FROM (SELECT title, MIN(pubdate) FROM books);

SELECT title FROM books WHERE pubdate = (SELECT MIN(pubdate) FROM books);

(TCO 7) Which of the values listed below can be returned by a subquery referenced as follows?WHERE vendorid = (subquery)

Page 23: Cis 336 full course   new

A single value

A column of one or more rows

A table

A subquery can’t be used in this way

(TCO 7) Which operator can be used to test that one or more rows are returned by the subquery?

IS NULL

IS NOT NULL

EXISTS

NOT EXISTS

(TCO 7) Given the two tables described below, which of the following queries will display the names of the customers whose orders have shipped?customer:  with the fields customerid(PK), lastname, firstnameorder:  with the fields orderid(PK), orderdate, shipdate, customerid(FK)

SELECT lastname, firstname FROM customer WHERE customerid = (SELECT customerID FROM order WHERE shipdate = orderdate);

SELECT lastname, firstname FROM customer WHERE customerid = (SELECT customerID FROM order WHERE orderID IS NULL);

SELECT lastname, firstname FROM customer WHERE customerid = (SELECT customerID FROM order WHERE shipdate IS NULL);

SELECT lastname, firstname FROM customer WHERE customerid = (SELECT customerID FROM order WHERE shipdate IS NOT NULL);

(TCO 7) Given the two tables described below, which of the following queries will display number of orders not yet shipped?customer:  with the fields customerid(PK), lastname, firstnameorder:  with the fields orderid(PK), orderdate, shipdate, customerid(FK)

SELECT COUNT(shipdate) FROM order;

SELECT COUNT(*) FROM order WHERE shipdate IS NULL;

SELECT COUNT(*) FROM order WHERE shipdate IS NOT NULL;

Page 24: Cis 336 full course   new

SELECT COUNT(shipdate) FROM order GROUP BY customerid;

(TCO 7) Given the books table described below, which of the following will display the average retail price of books?books:   bookid(PK), ISBN, title, pubdate, cost, retail, category, pubid(FK)

SELECT COUNT(retail) FROM books;

SELECT SUM(retail) FROM books;

SELECT AVG(retail) FROM books;

SELECT AVG(retail) FROM books GROUP BY category;

(TCO 7) Which of these scenarios would justify the usage of an aggregate function?

When we need to sum up values

When we need to convert string data into date or number values

When we need to select rows from a table with a condition that depends on the data from a different table

No way to tell without an ERD

CIS 336 Discussions Week 1-7 All Posts 581 Pages DeVry

CIS 336 Normal Forms and Entity Relationship Diagrams and Lab Forum Discussions Week 1 All Posts 80 Pages DeVry

CIS 336 Normal Forms and Entity Relationship Diagrams Discussions Week 1 All Post 40 Pages DeVry

We hear the term database all the time. Give some examples of databases that you interact with on a regular basis. What makes a database relational? What is a file storage system? How does a relational database differ from a file storage system?  Class would you consider a Microsoft Excel spreadsheet a relational database?  Why/why not? How about Excel inclusion for “referential integrity”? What about concerns regarding end-users training to recognize spreadsheet limitations? Under what circumstances would data inconsistencies occur in a database?…

CIS 336 Lab Forum Discussions 2 Week 1 All Posts 40 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. What is

Page 25: Cis 336 full course   new

the difference between an operational and a transactional database? What is the main purpose for a data warehouse? What distinguishes an operational versus a data warehouse database? How would you compare a “relational database” against a “Network database”?….

CIS 336 Developing a Good Data Model and Lab Forum Discussions Week 2 All Posts 72 Pages DeVry

CIS 336 Developing a Good Data Model Discussions 1 Week 2 All Post 37 Pages DeVry

The database data model is the communication link between the designer, applications programmer, and user. Contribute your views on what constitutes a good data model and why. What is CARDINALITY? How about an example?  How does cardinality/ordinality portrayed using Crow’s Feet? what constraints enforce semantic integrity?…

CIS 336 Lab Forum Discussions 2 Week 2 All Posts 35 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. Briefly describe the different types of database keys. Class who wants to enlighten us with an example for a super key? How about a business application that we would need to use a super key? A requirement of entity integrity is that all primary key entries are unique and no part of a primary key may be null. Do you concur, why/why not?…

CIS 336 Building the Physical Model and Lab Forum Discussions Week 3 All Posts 83 Pages DeVry

CIS 336 Building the Physical Model Discussions 1 Week 3 All Post 40 Pages DeVry

What is the importance of constraints in a physical model? What role do different constraints play in maintaining referential integrity and data integrity? It is possible for a table to be in BCNF but not in 3NF; do you concur? Why or why not?  Revisiting foreign keys, what would impact the ability to add or delete rows from a table or the ability to drop tables from a database schema?  What should be some of the considerations?….

CIS 336 Lab Forum Discussions 2 Week 3 All Posts 43 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. How about sharing with the class 2-3 SQL insert statements to populate the Student table? Do you have any tips on how to use Snipping Tool?  Are there are similar tools available that you want to share with the class?….

Page 26: Cis 336 full course   new

CIS 336 Understanding the SELECT Statement and Lab Forum Discussions 2 Week 4 All Posts 105 Pages DeVry

CIS 336 Understanding the SELECT Statement Discussions 1 Week 4 All Post 48 Pages DeVry

Reports are generated using queries to a database. The SELECT statement is used to retrieve data from one or many tables in a database. Just as in other programming languages, understanding the syntax of a select statement is key. Let’s first discuss the key clauses in a SELECT statement and the purpose of each.  What are the different clauses of the SELECT statement? Which SQL “SELECT” attribute elements are required and which are optional? How about sorting query results…

CIS 336 Lab Forum Discussions 2 Week 4 All Posts 57 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. Class who wants to briefly explain that the UNION statement combines rows from two or more queries without including duplicate rows?  How about an example? Class who wants to describe/dissect for us the following SQL statement?…

CIS 336 Getting Data From Multiple Tables and Lab Forum Discussions  Week 5 All Posts 84 Pages DeVry

CIS 336 Getting Data From Multiple Tables Discussions 1 Week 5 All Post 42 Pages DeVry

It is not uncommon to have to retrieve data that resides in several tables, especially when formulating a report. Discuss some of the performance issues when querying three or four tables at a time. Briefly explain the difference between an equijoin and a non-equijoin. What about a “trigger”?  What is it? What would be its purpose? Briefly discuss how a NATURAL JOIN, JOIN ON, and JOIN USING are alike and yet different. How is an INNER JOIN different from a LEFT OUTER JOIN? How do you decide when to use each type of join?…

CIS 336 Lab Forum Discussions 2 Week 5 All Posts 42 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. Enlighten us with 1-2 examples using SYSDATE and displaying different pieces of information.  What is the key difference between the following SQL LIKE statements?  Why would you not want to specify the entire characters? LIKE ‘Burt%’ versus  LIKE ‘Burt Ruggles%’  Based on your experiences with other SQL languages (like MySQL, all SQL-standard DBMSs support date and time functions?…

Page 27: Cis 336 full course   new

CIS 336 How Group Functions Differ From Single-Row Functions and Lab Forum Discussions Week 6 All Post 83 Pages DeVry

CIS 336 How Group Functions Differ From Single-Row Functions Discussions 1 Week 6 All Posts 38 Pages DeVry

What are some examples of group functions, and how do they differ from single-row functions? Discuss differences between SUM and COUNT. What be the expected results if the following SQL statements are executed?

SELECT retail

FROM books, publisher

WHERE books.pubid = publisher.pubid and publishername = ‘PRINTING IS US’;

 UPDATE books

SET retail = (retail * 1.05)

WHERE pubid =

    (SELECT pubid

     FROM publisher

     WHERE publishername = ‘PRINTING IS US’);

 SELECT retail

FROM books, publisher

WHERE books.pubid = publisher.pubid and publishername = ‘PRINTING IS US’;

What is the purpose for using HAVING clause? What’s the difference between the TO_CHAR and TO_DATE functions when working with date values?…

CIS 336 Lab Forum Discussions 2 Week 6 All Posts 45 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. MySQL will allow you to increase, but not decrease the size of a column; however, if the system you are working on allows you to make changes to the column width without restrictions, what would happen to a customer first name field that went from 20 characters to eight characters? If this is not a primary key, does it matter? What is the difference between DROP, TRUNCATE, and

Page 28: Cis 336 full course   new

DELETE? How about some examples to contrast DROP, TRUNCATE and DELETE? What is the purpose for the HAVING clause in MySQL?  How about enlighten us with an SQL examples that include the HAVING clause?…

CIS 336 Database Views and Lab Forum Discussions Week 7 All Posts 74 Pages DeVry

CIS 336 Database Views Discussions 1 Week 7 All Post 35 Pages DeVry

What are the advantages of selecting data from a view over selecting data from a base table? All in addition to limiting the actual tables or columns that a user has access to, you can also limit what the user does? What are some of the ROLES you might assign to users and what would these roles do? Beyond monitoring databases activities by end users, how can logs be utilized say for security purposes? What special considerations must you take into account when contemplating the introduction of a DBMS into an organization? Why prior to modifying a table is a good practice for locking the table?…

CIS 336 Lab Forum Discussions 2 Week 7 All Posts 39 Pages DeVry

This area is used to discuss the lab assignments and techniques. Please post any questions you have about the labs or tips that you have discovered during your learning process. At a minimum, post at least three notes that highlight your experience or problems with this week’s lab. Looking back on last week’s lab, some of the queries required you to join at least four tables. How would a view make it easier to retrieve this same information? What MySQL string function should you use to list the first three characters of a company’s EMP_LNAME values? Give an example, using a table named EMPLOYEE. Why is it a good idea to remove a view prior to recreating it? What is the purpose for the following MySQL statement? What is dynamic SQL and how does it differ from static SQL? Consider the data in any Human Resource database, if you had a “user front-end” (GUI) for this database, what would be some common types of information that you might want to display on one page? How would you do this with a view? Why/why not?…

CIS 336 Final Exam

.       Consider the ERD below. How many tables would be required to create a query to display the customer first and last name along with orderdate of each order they placed?

One

Two

Three

Four

2. Which of the following statements is correct? (Points : 4)

Page 29: Cis 336 full course   new

WHERE operates on groups formed by aggregate functions and HAVING operates on individual rows.

WHERE can only be used along with HAVING.

HAVING can only be used along with WHERE.

WHERE operates on individual rows and HAVING operates on group formed by aggregate functions.

3. You can code views that _____. (Points : 4)

Join tables

Summarize data

Use subqueries and functions

All of the above

4. The customer table’s primary key is CustomerID. It has no null entries, and all values are unique. This is an example of _____ integrity. (Points : 4)

Entity

Referential

Relational

Logical

5. In the following command, the primary key constraint is created at the _____ level.

                CREATE TABLE vendors

                (

                     vendorID                        INT,

                    vendorName                 VARCHAR(20),

                   CONSTRAINT vendor_pk PRIMARY KEY (vendorID)

                ); (Points : 4)

Table

Page 30: Cis 336 full course   new

Column

Database

Alter

6. Which join syntax is required if the primary key and foreign key have different names?

Natural join

JOIN USING

JOIN ON

Any can be used

7. To be in the third normal form, _____. (Points : 4)

Each non-key column depend only on the primary key

Each non-key column must not depend on the primary key

Each non-key column must contain repeating values

All of the above

(TCO 2) A _____ relationship must be implemented by creating a new entity that has 1:M relationships with the two original entities. (Points: 4)        

1:11:MM:1

M:N

(TCO 2) _____ integrity dictates that the foreign key must contain values that match the primary key in the related table or must contain null. (Points : 4)Entity

ReferentialRelationalLogical(TCO 8) Which command is used to remove a table named products in MySQL? (Points : 4)DROP TABLE products;

Page 31: Cis 336 full course   new

REMOVE TABLE products;ALTER TABLE products DROP;DELETE TABLE products;(TCO 6) The special operator used to check if a value matches one of a list of specific values is _____. (Points : 4)BETWEENNULLLIKEIN(TCO 2) A _____ key is a key that is composed of more than one attribute. (Points : 4)primaryforeign       composite       domain(TCO 3) When looking at a relationship between two tables on an ERD, the child table can be identified by the presence of a _____ constraint. (Points : 4)UNIQUENOT NULLFOREIGN KEYPRIMARY KEY(TCO 3) When a constraint is created at the _____ level in a CREATE TABLE command, the constraint definition is simply included as part of the attribute definition. (Points : 4)tablecolumndatabasealter(TCO 7) The SQL aggregate function that determines the highest value in a given column is _____. (Points : 4)COUNTMAXMAXIMUMSUM(TCO 7) Which join syntax is required if the primary key and foreign key have different names? (Points : 4)Natural joinJOIN USINGJOIN ONAny can be used(TCO 6) When using the MySQL DATE_FORMAT function, which code displays a full month name? (Points : 4)%M%m%b%mon(TCO 3) Which keyword is used to require that a value be entered for the attribute?

Page 32: Cis 336 full course   new

(Points : 4)FOREIGN KEYDEFAULTNOT NULLAUTO_INCREMENT(TCO 2) When identifying potential entities for an ERD, look for the _____ in the business narrative. (Points : 4)adjectivesadverbsnounsverbs(TCO 2) To apply the second normal form, you move columns that don’t depend on the entire primary key to another table and establish a relationship between the two tables. This _____. (Points : 4)reduces redundancy but makes maintenance more difficultreduces redundancy and makes maintenance easier

increases redundancy but makes maintenance easierincreases redundancy but makes the data more consistent (TCO 2) A _____ means that a nonprime attribute is functionally dependent on only part of a table’s primary key but not the entire primary key. (Points : 4)Partial dependencytransitive dependencyrepeating groupprimary key(TCO 4) In a typical online store scenario, which of the following diagrams best represents the relationship between customers and orders placed by customers? (Points : 4)(TCO 4) A(n) _____ provides a graphical description of a data model. (Points : 4) Entity relationship diagram

Data dictionary

Business rule

Psuedocode(TCO 3) Which statement is false regarding the creation of a foreign key constraint at table level or with an ALTER statement? (Points : 4) The parent table must already exist

The field must already be defined in the tableThe PK and FK fields must have the same name

The PK and FK fields may have different names

Page 33: Cis 336 full course   new

(TCO 3) You are creating a table called Department with fields for the primary key DeptID (Integer) and department name (VARCHAR). What (if anything) is wrong with the following code?CREATE TABLE Department(deptID        INTEGER   Primary Key,deptName VARCHAR(10) NOT NULL); (Points : 4) You must use curly braces, not parentheses

The field names must be all lowercaseThe keywords cannot be in uppercase

Nothing is wrong

(TCO 6) Given a table orders with fields for orderid, orderdate, and shipdate, which query will display the orderid for only those orders that have shipped? (Points : 4) SELECT ordered FROM orders WHERE shipdate <> orderdate;

SELECT ordered FROM orders WHERE shipdate IS NOT NULLSELECT orderid FROM orders WHERE shipdate IS NULL;

SELECT orderid FROM orders;

(TCO 6) Which WHERE clause will return data on all employees whose last name starts with ‘Smith’? (Points : 4)

WHERE lastname LIKE ‘Smith

WHERE lastname LIKE ‘Smith%’WHERE lastname LIKE ‘%Smith%’WHERE lastname LIKE ‘%Smith

(TCO 7) Consider the ERD below. How many tables would be required to create a query to display the description of each product ordered along with the first and last name of the customer that ordered it?

(Points : 4) One

Two

Three

Four

Page 34: Cis 336 full course   new

(TCO 7) A full outer join returns _____. (Points : 4) rows in the left table that don’t satisfy the join condition

unmatched rows from both the left and right tablesrows in the right table that don’t satisfy the join conditionthe Cartesian product of the two tables

(TCO 7) What type of subquery is executed once for each row processed by the main query? (Points : 4) Correlated

Uncorrelated

InnerOuter(TCO 7) If your SELECT clause contains both aggregate and non-aggregate functions, _____. (Points : 4) All non-aggregate columns must be included in a WHERE clause

All non-aggregate columns must be included in a GROUP BY clause

All aggregate and non-aggregate columns must be included in a GROUP BY clauseAll aggregate columns must be included in a WHERE clause

(TCO 9) Which of the following is not a benefit provided by using a view? (Points : 4) (TCO 6) Write a query to list the customer first name, last name as a single field with a heading  of Customer along with the balance sorted by balance from lowest to highest. (Points : 10) (TCO 6) Write a query to display the customer number, last name and first name for every customer represented by sales rep 15 or sales rep 20. (Points : 10)

(TCO 6) Display all of the information from the part table for parts with a retail price below 100 and zero on hand. (Points : 10)(TCO 7) Write a query to display the orderid, order date, customer last name and firstname for all orders that have not shipped. (Points : 10)

(TCO 7) Write a query to display the average retail price of all products formatted to display with two decimal places. (Points : 10)

(TCO 7) Write a query using JOINS to list the orderid, partid, and part description and units on hand or every order that has not shipped. (Points : 10)

(TCO 7) Write a query to display each sales reps ID and the total number of customers that they have. Only include those reps that have more than 10 customers. (Points : 10) (TCO 7) Using a subquery, list the partid and description of all parts where the number of

Page 35: Cis 336 full course   new

units on hand is greater than the average of units on hand for all parts. (Points : 10)