SlideShare ist ein Scribd-Unternehmen logo
1 von 62
Downloaden Sie, um offline zu lesen
CIS 336: All iLabs Week 1 to Week 7: Devry University
For more course tutorials visit
www.tutorialrank.com
CIS 336: All iLabs Week 1 to Week 7: Devry University
---------------------------------------------------------------
CIS 336 Entire Course: Devry University
For more course tutorials visit
www.tutorialrank.com
CIS 336 Entire Course: Devry University
---------------------------------------------------------------
CIS 336 Final Exam 1
For more course tutorials visit
www.tutorialrank.com
1. (TCO 1) Most DBMS are referred to as _____________database
management systems. (Points : 4)
elemental
linked
hierarchical
relational
2. (TCO 1) Data constitutes the building blocks of _____________.
(Points : 4)
information
processing
applications
programming
3. (TCO 2) If a foreign key contains either matching values or nulls, the
table(s) that make use of such a foreign key is/are said to exhibit
__________ integrity. (Points : 4)
referential
restrictive
secondary
redundant
4. (TCO 2) In a "one-to-many" relationship, which constraint is usually
added to the "many" table?
(Points : 4)
UNIQUE
PRIMARY KEY
FOREIGN KEY
NOT NULL
5. (TCO 3) A ____ occurs when a relationship is improperly or
incompletely identified and, therefore, is represented in a way that is not
consistent with the real world. (Points : 4)
surrogate primary keys
time-variant data
design trap
fan trap
6. (TCO 3) All of the following are true about a prime attribute
except_____________. (Points : 4)
it is a key attribute
it is at least part of a key
it is not a key attribute
it may be part of a composite key
7. (TCO 3) The conflicts between design efficiency, information
requirements, and processing speed are often resolved
through_____________. (Points : 4)
conversion from 1NF to 2NF
conversion from 2NF to 3NF
compromises that include denormalization
conversion from 3NF to 4NF
8. (TCO 4) When a constraint is created at the ______ level with the
CREATE TABLE command, the constraint definition is simply included
as part of the column definition.(Points : 4)
table
column
database
row
Page 2 - Multiple Choice
1. (TCO 4) In Oracle, the CONSTRAINT clause is used to
___________________. (Points : 4)
create only referential constraints
define and name any constraint
create a short cut so the constraint does not have to be named
create only entity entegrity constraints
2. (TCO 4) The SQL command that lets you list the table contents is
(Points : 4)
insert.
select.
commit.
update.
rollback.
3. (TCO 5) The Crow's Foot model is more ___________-oriented than
the Chen model. (Points : 4)
object
user
implementation
processor
4. (TCO 5) The ___________ model is both software and hardware
dependent. (Points : 4)
conceptual
logical
condensed
physical
5. (TCO 6) Which of the following commands will add a new column
named FIRSTORDERDATE to the CUSTOMERS table to store the date
that the customer first placed an order with the company? (Points : 4)
CREATE COLUMN firstorderdate, DATE TO customers;
ALTER TABLE customers ADD COLUMN firstorderdate DATE;
ALTER TABLE customers ADD firstorderdate DATE;
ALTER TABLE customers ADD (firstorderdate DATE);
6. (TCO 6) When modifying the data characteristics of a column in
Oracle, which of the following is correct? (Points : 4)
The column size can be increased.
The size of the column can be decreased.
Changing the default value of a column will change the values of data
already in a table.
If a NUMBER column is empty, its precision and scale cannot be
changed.
7. (TCO 6) Which of the followig SQL commands would alter the table
DEVRY and add a foreign key that references the CITY table? (Points :
4)
ALTER table DEVRY
ADD CONSTRAINT devry_studentcity_fk references city;
ALTER table DEVRY
ADD CONSTRAINT devry_studentcity_fk FOREIGN KEY references
city;
ALTER table DEVRY
ADD CONSTRAINT devry_studentcity_fk FOREIGN KEY
(student_city) references city;
ALTER table DEVRY
ADD CONSTRAINT FOREIGN KEY (student_city) references city;
8. (TCO 7) Given a table named EMPLOYEE, the SQL command to
sort records in a specific order would be: (Points : 4)
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL,
EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
LIST BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL,
EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL,
EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
DISPLAY BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL,
EMP_AREACODE, EMP_PHONE
FROM EMPLOYEE
SEQUENCE BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
Page 3 - Multiple Choice
1. (TCO 7) Which of the following subqueries returns more than one
row of results to the outer query? (Points : 4)
multiple-column subquery
single-row subquery
multiple-row subquery
correlated subquery
2. (TCO 7) Which of the following keywords can be used to join two
tables that do not contain a commonly named and defined column?
(Points : 4)
NATURAL JOIN
JOIN...ON
JOIN...USING
JOIN...WHERE
3. (TCO 8) Based upon the contents of the BOOKS table shown below,
which of the following SQL statements will return the number of
categories contained in the table?
(Points : 4)
SELECT COUNT(DISTINCT category) FROM books;
SELECT DISTINCT COUNT(category) FROM books;
SELECT DISTINCT (COUNT(category)) FROM books;
SELECT DISTINCT COUNT(category) FROM books;
4. (TCO 8) The _____________ function can be used to display upper-
case characters in lower-case. (Points : 4)
CONVERT
MIN
LESS
LOWER
5. (TCO 8) Which of the following statements will produce the value
21.1? (Points : 4)
SELECT ROUND(21.12, 1) FROM dual;
SELECT ROUND(21.12, -1) FROM dual;
SELECT ROUND(21.12, 0) FROM dual;
SELECT ROUND(21.12, 0+) FROM dual;
6. (TCO 9) The column to be updated by the UPDATE command is
specified in the ______ clause. (Points : 4)
UPDATE
SET
WHERE
COL
7. (TCO 9) If the INSERT INTO command is used to insert data values
that violate an existing constraint in a table, which of the following will
happen. (Points : 4)
Oracle will raise an error and you will have to go update the incorrect
data.
Oracle will raise an error and the entire row will be rejected.
Oracle will raise an error and the invalid piece of data will be rejected.
Oracle will raise and error and all current transactions will be rolled
back.
8. (TCO 10) Which of the following commands is used to establish a
user account? (Points : 4)
CREATE NEW USER username
IDENTIFIED BY password;
CREATE USERNAME username
IDENTITY password;
CREATE USER username PASSWORD password;
CREATE USER username IDENTIFIED BY password;
9. (TCO 10) Which command will grant a system privilege to a user?
(Points : 4)
GRANT systemprivilegeUSERNAME username
GRANT PRIVILEGE systemprivilegeTO username
GRANT systemprivilegeTO
username
GRANT systemprivilege ON
username
---------------------------------------------------------------
CIS 336 Final Exam 2
For more course tutorials visit
www.tutorialrank.com
1. (TCO 1) Most DBMS are referred to as _____________database
management systems. (Points : 4)
elemental
linked
hierarchical
relational
2. (TCO 1) A relational DBMS provides protection of the
_______________________ through security, control, and recovery
facilities. (Points : 4)
user
network
system
database
3. (TCO 2) If a foreign key contains either matching values or nulls, the
table(s) that make use of such a foreign key is/are said to exhibit
__________ integrity. (Points : 4)
referential
restrictive
secondary
redundant
4. (TCO 2) A field that consists of integer values is a _________ type
field. (Points : 4)
Date/Time
Yes/No
Memo
Numeric
5. (TCO 3) The PK must uniquely identify each entity instance. A
primary key must be able to guarantee unique values. It cannot contain
nulls. This rationale belongs to ____. (Points : 4)
Unique values
Nonintelligent
Preferably single-attribute
Security complaint
6. (TCO 3) A table that is in 1NF and includes no partial dependencies
only is said to be in_____________. (Points : 4)
1NF.
2NF.
3NF.
4NF.
BCNF.
7. (TCO 3) A table that has all key attributes defined, has no repeating
groups, and all its attributes are dependent on the primary key, is said to
be in_____________.(Points : 4)
1NF.
2NF.
3NF.
4NF.
BCNF.
8. (TCO 4) In Oracle, the DEFAULT constraint is used to
____________________. (Points : 4)
define which column is the default primary key if one is not explicitly
named
define which column is the default foreign key if on is not explicitly
named
assign a value to an attribute when a new row is added and a value is not
defined
validate data when a value is added to an attribute
Page 2 - Multiple Choice
1. (TCO 4) Which of the following is not considered a database object?
(Points : 4)
a table
a view
a constraint
a sequence
an index
2. (TCO 4) Which of the following SQL statements would you use to
create a table named DEVRY? (Points : 4)
CREATE Devry
(
Student_id NUMBER (12),
Student_name VARCHAR2 (15),
Student_city VARCHAR2 (12)
);
CREATE TABLE Devry
(
Student_id NUMBER (12)
Student_name VARCHAR2 (15)
Student_city VARCHAR2 (12)
);
CREATE TABLE Devry
(
Student_id NUMBER (12),
Student_name VARCHAR2 (15),
Student_city VARCHAR2 (12)
);
CREATE TABLE Devry
Student_id NUMBER (12),
Student_name VARCHAR2 (15),
Student_city VARCHAR2 (12);
3. (TCO 5) The ____ constraint requires that a specific condition be met
before a record can be added to a table. (Points : 4)
UNIQUE
REFERENCE
CONDITION
CHECK
4. (TCO 5) The ___________ model is both software and hardware
dependent. (Points : 4)
conceptual
logical
condensed
physical
5. (TCO 6) The _________________________ statement can be used to
enable or disable a constraint. (Points : 4)
alter table
modify table
create table
update table
6. (TCO 6) When using the ALTER TABLE...DROP COLUMN
command, which of the following is not correct? (Points : 4)
The command's effect on the table is permanent.
You cannot delete the last remaining column in a table.
The command deletes both the column and its contents.
The command can be used to delete multiple columns from a table.
7. (TCO 6) Which of the following keywords can be used to change the
size, datatype, and/or default value of an existing column? (Points : 4)
ADD
MODIFY
CHANGE
RESET
8. (TCO 7) Any type of subquery can be used in the _________ clause
of a SELECT statement. (Points : 4)
WHERE
HAVING
FROM
ORDER BY
GROUP
Page 3 - Multiple Choice
1. (TCO 7) Using the BOOK_CUSTOMER and BOOK_ORDER tables
shown below for references, which SQL statement will return the same
results as the following SQL statement?
SELECT * FROM book_customer, book_order;
(Points : 4)
SELECT * FROM book_order CROSS JOIN book_customer;
SELECT * FROM book_order, book_customer
WHERE book_order.customer# = book_customer.customer#;
SELECT * FROM book_order, book_customer
WHERE book_order.customer# >book_customer.customer#;
SELECT * FROM o book_order , c book_customer
WHERE o.customer# = c.customer#;
2. (TCO 7) If a Cartesian join is used to link table A which contains five
rows to table B which contains eight rows, there will be _______ rows
in the results. (Points : 4)
8
13
5
40
3. (TCO 8) Based upon the contents of the BOOK_ORDER table shown
below, which of the following SQL statements will display the ship date
for order 1006 as April 2, 2002?
(Points : 4)
SELECT order#, TO_CHAR(shipdate, 'fmMonth DD, YYYY')
FROM book_order;
SELECT order#, TO_DATE(shipdate, 'fmMonth DD, YYYY')
FROM book_order;
SELECT order#, TO_CHAR(shipdate, 'Month DD, YYYY')
FROM book_order;
SELECT order#, TO_DATE(shipdate, 'Month DD, YYYY')
FROM book_order;
4. (TCO 8) Based upon the contents of the BOOK_ORDER table shown
below, which of the following SQL statements will display only those
orders shipped to the zip code zone that begins with 323?
(Points : 4)
SELECT order#, SUBSTR(shipzip, 1, 323)
FROM book_order;
SELECT order#, SUBSTR(shipzip, 1, 323)
FROM book_order
WHERE ;
SELECT order#
FROM book_order
WHERE (shipzip, 1, 323);
SELECT order#
FROM book_order
WHERE SUBSTR(shipzip, 1, 3) = 323;
5. (TCO 8) Which of the following functions determines the number of
characters in a character string? (Points : 4)
COUNT
NUMBER
LENGTH
DECODE
6. (TCO 9) Which of the following is not a valid SQL command?
(Points : 4)
UPDATE acctmanager SET WHERE ;
UPDATE acctmanager SET (amname);
UPDATE acctmanager SET (amname) WHERE ;
UPDATE acctmanager WHERE ;
7. (TCO 9) Using the promotion table shown below, which of the
following SQL statements will insert a new row into the PROMOTION
table?
(Points : 4)
INSERT INTO promotion (gift, minretail, maxretail)
VALUES (FREE BOOK, 75.01, 89.99);
INSERT INTO promotion (gift, minretail, maxretail)
VALUES ('FREE BOOK', 75.01, 89.99);
INSERT INTO promotion VALUES (FREE BOOK, 75.01, 89.99);
INSERT INTO promotion (gift, minretail)
VALUES (FREE BOOK, 75.01, 89.99);
8. (TCO 10) A ____ is a uniquely identifiable object that allows a given
person to log on to the database. (Points : 4)
user
role
profile
manager
9. (TCO 10) Which command will delete a user account from Oracle9i?
(Points : 4)
DELETE USER username;
DELETE USER username IDENTIFIED BY password;
DROP USER username IDENTIFIED BY password;
DROP USER username;
Page 4 - Essays
1. (TCO 2) What is Character data? (Points : 15)
2. (TCO 3) Explain the term "second normal form". (Points : 15)
3. (TCO 7) Sally needs to find all employees who have a date-of-hire
between 01-JAN-2003 and 01-JAN-2005. She writes and executes the
following query:
4. (TCO 8) In using group functions we cannot place a group function in
a WHERE clause. Explain how the WHERE clause and HAVING clause
are similar and why you can use the HAVING with a group function but
not a WHERE clause. (Points : 15)
5. (TCO 6) Write the SQL statement that will remove the database table
EMPLOYEE. (Points : 15)
1. (TCO 7) Write a join query using NATURAL JOIN that for every
order in the ORDERS table will list the order number and order date
along with the cusnumber, last name, and first name of the customer
who placed the order.
2. (TCO 8) Write a query that will list the part number, part description,
and on-hand value (units on hand * unit price) for each part in item class
AP. Give the expression an alias of "On Hand Value".
3. (TCO 8) Write a sub query that will list the part number, part
description, and units on hand of all parts where the number of units on
hand is greater than the average of units on hand for all parts.
4. (TCO 7) Using the BETWEEN operator, write a query that will list all
details about all orders that were placed during the period of September
3rd thru September 5th of 1998.
5. (TCO 7) Write a query that will list the part number and part
description for all parts in the PART table.
(Points : 15)
---------------------------------------------------------------
CIS 336 Final Exam 3
For more course tutorials visit
www.tutorialrank.com
1. (TCO 2) Explain what physical independence means. (Points : 15)
2. (TCO 8) Sally wants to query the EMP table and determine how many
of the employees live in each of the cities the company has factories in.
She writes the following query but it does not work. What is wrong with
the way the query is constructed?
3. (TCO 3) Explain in what two specific cases presented in the text
composite primary keys are particularly useful. (Points : 15)
4. (TCO 7) How are comparisons done on character string data in a
queries WHERE clause, and why would this be especially useful in
comparing certain attributes? (Points : 15)
5. (TCO 6) Oracle will not allow the changing of a column's data type
unless the column is empty, and even then it may still be prohibited.
Discuss why? (Points : 15)
6. (TCO 7) Write a join query using NATURAL JOIN that for every
order in the ORDERS table will list the order number and order date
along with the cusnumber, last name, and first name of the customer
who placed the order.
7. (TCO 8) Write a query that will list the part number, part description,
and on-hand value (units on hand * unit price) for each part in item class
AP. Give the expression an alias of "On Hand Value".
8. (TCO 8) Write a query that will display the customer number, first
name, and last name for every customer with a balance greater than $50.
Display the first and last name as a single column and provide an alias
for the column.
9. (TCO 7) Write a query that will list the customer number, last name,
and first name for every customer represented by sales rep 03 or sales
rep 12.
10. (TCO 7) Write a query that will list the customer first and last name
and the sales rep commission rate using JOIN ON.
---------------------------------------------------------------
CIS 336 Final Exam 4 Sets of Answers
For more course tutorials visit
www.tutorialrank.com
CIS 336 Final Exam 4 Sets of Answers
---------------------------------------------------------------
CIS 336 Final Exam 4
For more course tutorials visit
www.tutorialrank.com
1. (TCO 7) For every order, list the order number, order date, part
number, part description, and item class for each part that makes up the
order.
2. (TCO 8) Write a query that will display the customer number, last
name, and first name for every customer I whose first name begins with
the letter "D".
2. (TCO 8) Write a query that will display the earliest date an order was
placed.
3. (TCO 7) Using the BETWEEN operator, write a query that will list all
details about all orders that were placed during the period of September
3rd thru September 5th of 1998.
5. (TCO 7) Write a query that will list the customer first and last name
and the sales rep commission rate using JOIN ON.
---------------------------------------------------------------
CIS 336 Quiz 1
For more course tutorials visit
www.tutorialrank.com
(TCO 3) Normalization works through a series of stages called normal
forms. Typically _________ stages must be completed before a table can
be considered normalized.
(TCO 3) The conflicts between design efficiency, information
requirements, and processing speed are often resolved through
(TCO 3) The PK must uniquely identify each entity instance. A primary
key must be able to guarantee unique values. It cannot contain nulls.
This rationale belongs to
(TCO 9) The SQL command that lets you insert data into a table, one
row at a time, is _____________.
(TCO 4) Which command is used to restore the table's contents to their
default values?
(TCO 4) Which of the following SQL commands would alter the table
DEVRY and add a foreign key that references the CITY table?
(TCO 4) The SQL command that lets you save your work to disk, is
___________
(TCO 9) If the INSERT INTO command is used to insert data values
that violate an existing constraint in a table, which of the following will
happen?
(TCO 3) Explain under what circumstances a partial dependency can
exist in a database.
---------------------------------------------------------------
CIS 336 Quiz 2
For more course tutorials visit
www.tutorialrank.com
(TCO 2) Explain what a composite attribute is
(TCO 1) Data constitutes the building blocks of
(TCO 1) Successful database design is first and foremost based on
_____________ requirements.
(TCO 1) The lowest level in a database hierarchy is the ____________
or value as it is often referred
(TCO 2) The term _____________ design is used to refer to the task of
creating the conceptual data model represented by an Entity Relationship
Diagram (ERD).
(TCO 2) Within a table, the primary key must be unique so that it will
identify each row. When this is the case, the table is said to exhibit
___________.
(TCO 2) A field that consists of data values that can be used for
arithmetic procedures is a _________ type field.
(TCO 2) A relationship is an association between ___________
(TCO 5) The _____________ model represents a global view of the
data.
(TCO 5) In Crow's Foot notation, a forked end means
---------------------------------------------------------------
CIS 336 Quiz 3
For more course tutorials visit
www.tutorialrank.com
(TCO 7) Which of the following types of columns will automatically
right-align the data when it is displayed?
(TCO 7) Which of the following SQL statements will display the profit
generated by each book currently stored in the BOOKS table? (You do
not need to see the table structure for this question)
(TCO 7) Which of the following will display the new retail price of each
book as 20 percent more than it originally cost?
(TCO 7) Which of the following operators would be most appropriate to
determine whether or not the retail price of a book is at least $24.00?
(TCO 7) The ______________________ comparison operator is used to
indicate that a data value must fall within a range of values to be
included in the query results.
(TCO 7) Based upon the contents of the BOOK_ORDER table shown
below, which of the following queries will display all orders that were
not shipped for at least three days after the order was received?
(TCO 7) ANSI-standard SQL allows the use of a special operator in
conjunction with WHERE clause. A special operator used to check
whether an attribute matches one from a subquery is_______.
(TCO 7) A ____ occurs when a relationship is improperly or
incompletely identified and, therefore, is represented in a way that is not
consistent with the real world.
(TCO 7) The ______________________ comparison operator is used to
search for values which are not NULL.
TCO 7) You want to write a query that will return the customer number,
first and last name from the book_order table (shown below) for all
customers who have a P.O. Box and who live in either Trenton or
Chicago. Write the query that will accomplish this task.
---------------------------------------------------------------
CIS 336 Quiz 4
For more course tutorials visit
www.tutorialrank.com
(TCO 8) If a Cartesian join is used to link table A which contains five
rows to table B which contains eight rows, there will be _______ rows
in the results.
(TCO 8) Which of the following statements will produce the value 21.1?
(TCO 8) Which of the following format elements will display
insignificant leading zeros?
(TCO 8) Oracle’s pseudo table used only for cases where a table is not
really needed is _________?
(TCO 7) Using the BOOK_CUSTOMER and BOOK_ORDER tables
shown below for reference which SQL statement will return the same
results as the following SQL statement?
(TCO 7) A table alias or qualifier cannot be assigned in the FROM
clause of which type of join?
(TCO 7) The _______ query joins a table to itself using aliases to
distinctly identify each instance of the table.
(TCO 7) Explain the difference between an inner join and an outer join.
---------------------------------------------------------------
CIS 336 Quiz 5
For more course tutorials visit
www.tutorialrank.com
(TCO 6) Which of the following keywords is used to remove a row in a
table?
(TCO 6) When using the ALTER TABLE...DROP COLUMN
command, which of the following is NOT correct?
(TCO 6) Which of the following commands will add a new column
named FIRSTORDERDATE to the CUSTOMERS table to store the date
that the customer first placed an order with the company?
(TCO 8) Which of the following is NOT a valid statement?
(TCO 8) Based on the contents of the BOOKS table shown below,
which of the following SQL statements will return the total profit
generated by books in the COOKING category?
(TCO 8) Which comparison operator evaluates a subquery and if it
returns false, will not execute the calling query?
(TCO 8) The following SQL statement contains which type of
subquery?
(TCO 9) If the _________ clause of the UPDATE command is omitted,
then all the rows in the specified table will be changed.
(TCO 9) Which of the following is not a valid SQL command?
(TCO 9) Based on the contents of the PROMOTION table, which of the
following commands will delete only the row for the Free Bookmark
from the table?
(TCO 8) In using group functions we cannot place a group function in a
WHERE clause. Explain how the WHERE clause and HAVING clause
similar and why you can use the HAVING with a group function but not
a WHERE clause.
---------------------------------------------------------------
CIS 336 Week 1 iLab 1 Devry University
For more course tutorials visit
www.tutorialrank.com
L A B O V E R V I E W 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. L A B S T E P S 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? OrdNoOrdDateCustNoEmpNo 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.
---------------------------------------------------------------
CIS 336 Week 2 iLab 2 Devry University
For more course tutorials visit
www.tutorialrank.com
Lab two introduces the next step in creating a data model, the Entity
Relationship Diagram (ERD). You will be given a business scenario for
a company named Clapham Specialty Store, which is a small specialist
grocery and delicatessen. 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 which 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. If there is not a single word that will apply, then supply a
separate name for each direction of the relationship. Narrative/Case
Study The Clapham Specialty Store is a small, specialist grocery and
delicatessen. A new owner, John Balfour, who would like to expand the
store and improve its profits, has recently purchased the store. The store
sells general groceries, wines and liquors, and has a small deli counter.
The store is open from 5:00 a.m. to 12:00 midnight. Many of the
customers are repeat customers who come in to buy products they forgot
from their regular grocery shopping expedition at the supermarket. The
store sells about 3,000 different products ranging from toilet cleaner to 2
oz. jars of caviar, and champagne to liverwurst. Each product is
displayed on a shelf on one side or the other of the aisle. The products
arrive and their details (cost, quantity, SKU number, package size,
purchase date) are recorded in the back room before they are displayed.
The new owner wants to know which 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 how busy 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
every employee. All employees are paid weekly against an hourly rate
which varies depending on their job description. Each sale is identified
by a Receipt No. and a timestamp (date and time) and consists of sale
items with a quantity and price recorded for each product. As a
convenience for known customers, they offer a local delivery service.
Deliveries are only made to customers who are registered at the store;
walk-ins must record their name, address, and phone 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 a point 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 the delivery, how long the delivery takes,
and the amount of the sale. There is concern at this point that 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 the information given to you by John
and his staff. Through analysis of the nouns and verbs in the case study
above, you have accumulated the following entity, attribute, and
relationship information shown in the table below. The attribute list may
not be complete. If you determine that additional attributes are needed to
better define an entity then you should add them. Entities Attributes and
Relationships for Clapham Store: Entity Attributes Relationships
Employee ID Number, Last Name, First Name, Phone Number,
Employee Type ID An Employee can belong to any one of the three job
categories, but can belong to one and only one of the three. Employees
have names and other contact information. Employee Type Type ID,
Description, Hourly Pay Rate An employee can be either a clerk,
delivery person, or a supervisor. Register Log Register Log Number,
Register Number, Log In Time, Log Out Time, Employee ID Sales are
made using a register and can be tracked by the register log number. An
employee must log into the register before he/she can use it and must log
out when finished with a shift at that register. An employee may use
more than one register during a period of work. Register Register
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 the store; one on the left and one on the right of the
entrance. Deliveries Delivery 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. An
employee can make many deliveries but a sale is delivered by one and
only one employee. Location Location ID, Aisle, Side, Shelf Relates to
product and identifies one or more areas of the store where products are
displayed. Product Product ID, Name, Package Size, Cost, Quantity on
Hand (QOH), Last Purchased Date, Reorder Minimum Identifies the
products the store sells. One or more products can be sold per sale. The
quantity on hand allows John to determine his inventory levels. The
reorder minimum can be used to determine when the inventory level has
reached a reorder point. Sale Receipt Number, Sales Amount, Sale Date-
Time A 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 one
delivery person. Sold Items Receipt Number, Product ID, Item Price,
Quantity Sold Sale Item is part of sale and records product sold per sale.
Sale item must be able to associate multiple products sold on a single
sales receipt. Customer Customer Number, First Name, Last Name,
Address, Phone Number A customer can be associated with multiple
sales, but any one sale is to one and only one customer. 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 Crow's
Foot notation. You will need to determine the cardinality and optionality
for each direction of the relationships. Some of the Foreign Key
relationships are identified in the graph above but not all. Be sure you
identify and account for all Foreign Key relationships. Add a name (in
both directions) to the relationships. Remember, if you can verbalize the
relationship in both directions then you probably have a valid
relationship. Deliverables The deliverable for this lab will be your
completed ERD as a single MS Word document using copy/paste from
the MS Visio application and named "lab2_solutions_yourname". L A B
S T E P S STEP 1: Drawing entities and attributes Be sure to include all
of the entities that have been defined. You need to include at least the
primary and foreign key attributes where applicable in your diagram.
STEP 2: Indication of all relationships Be sure that you link all entities
based on PK to FK relationships. There may be a case where you need to
identify a combination PK and if so make sure that all of the
relationships involved are defined. Be sure that you have set your Visio
editor to show Crow's Foot notation. Also, be sure that you are defining
the correct cardinality for the relationships. STEP 3: Naming of
relationships Do not accept the default naming convention for your
relationships in all cases. There may be some relationships where this is
applicable, but in most cases you will want to explicitly name the
relationship. Be sure that you have provided a verb phrase for both
directions in the relationship. This is the end of lab #2
---------------------------------------------------------------
CIS 336 Week 3 Group Project Task 1 Data Model
For more course tutorials visit
www.tutorialrank.com
Present a detailed data model for the project scenario. You can create
your data model using Microsoft Visio, which you will have access to
through iLab and Microsoft Excel, which comes with Microsoft Office.
Other tools may be used as long as the output is legible and conforms to
standard format. (i.e. I will not be able to grade the data model if I
cannot tell what it is supposed to be!). Your data model should include a
minimum of an ERD and metadata chart (data dictionary).
A key component to every task submission is the team responsibilities
document. This document should outline the contributions that each
member of the team made to completing the task deliverable. There is a
sample document in the Doc Sharing tab that can be used, or each team
can come up with their own design. As stated in the syllabus, although
this is a team project, each member will also be graded on their
involvement in the project. This assessment needs to be honest and
accurate in describing the individual members’ activities for the task.
Deliverables for this task:
A completed Data Model to include: An ERD, showing all tables,
related attributes, and the primary and foreign keys. This diagram must
show both the relationship and cardinality of the relationship using
accepted notation. A Data Dictionary (or meta data chart) showing a
minimum of the table name, columns, data types, length, and constraints.
Team member responsibilities document outlining contributions by team
members to this deliverable.
---------------------------------------------------------------
CIS 336 Week 3 iLab 3 Devry University
For more course tutorials visit
www.tutorialrank.com
Beginning with this lab, and continuing through the remaining weeks
you will be doing all of your work in Oracle itself. The editor interface
to the Oracle server is SQL*Plus, and by now you have received your
logon ID and password and should have at least made sure you can
connect. If for any reason you have not done so, please do so now before
continuing any further. If for any reason you cannot connect then you
need to let the instructor know ASAP so that any problems can be
resolved. Before attempting Lab #3, you need to be sure you have read
through the SQL*Plus tutorial which can be found in Doc Sharing as
well as under the SQL*Plus Tutorial tab in Week 3. This tutorial
describes the functionality of the editor and will take you through the
process of setting up and using the SQL*Plus in the iLab environment so
that it will best serve your needs for the remainder of the labs required
for this course. The lab for this week addresses taking a logical database
design (data model) and now transforming that into a physical model
(tables, constraints, and relationships). As part of the lab, you will need
to download the Zip file titled "Lab 3 Support Documents" from Doc
Sharing. This Zip file contains three documents: Lab 3 Relationship
Diagram.docx, Lab 3 Meta Data Diagram.xlsx, and Lab 3 Input
Data.docx. Your job will be to take the meta data defined in the data
dictionary spreadsheet document, and using the relationship diagram as
a guide 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.
Narrative/Case Study For this lab, you be working with command-line
SQL to build a series of relational tables, using SQL CREATE
statements in a script file format for the Student Database and 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: The drop table
statements listed later in the specifications of this lab. The CREATE
TABLE statements required to build the seven (7) tables. The INSERT
statements necessary to insert all of the sample data. 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 three documents which can be found in the Doc Sharing tab
on the course website: A Relationship Diagram of the database showing
in graphical form the 1:M relationships between the tables
(336_Lab3_Relationship_Diagram.doc). 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). 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 Explicitly name all constraints PRIMARY KEY,
FOREIGN KEY, and CHECK constraints to reflect:
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 constraints Create all PRIMARY KEY and
NOT NULL constraints within the CREATE TABLE statements at the
column level (line level), unless the Primary Key is a composite Primary
Key (yes, there is one). Composite Primary Key constraints must be
created at the table level. Create all FOREIGN KEY and CHECK
constraints at the table level using ALTER TABLE statements. All
constraints must be added prior to populating the tables with data. Create
all of the tables and all of the constraints before populating any of the
tables with data. Insert statements must be in the same order as the tables
are created (follow the order in the sample data file). ALL character
strings must be enclosed in single quotes. This includes alpha strings and
alphanumeric (remember that any formatting within a numeric strings
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. Deliverables The
deliverable for this lab will include the following documents. 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 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 both the SQL
commands and results will show in the output. Be sure your name is on
all documents and that all documents have been included in a single Zip
file for this week’s assignments. L A B S T E P S STEP 1: The DROP
statements The following DROP TABLE statements must appear at the
top of your script file. This will allow you to run and re-run your script
file as often as you need to. The first time you run your script file you
will get an ERROR on the drop statements saying the Table or View
does not exist. This is true since it has not been created yet, but the error
is more informational than anything. Once the tables are created, you
will not get this error again. DROP TABLE ENROLLMENT
CASCADE CONSTRAINTS PURGE; DROP TABLE
COURSE_SECTION CASCADE CONSTRAINTS PURGE; DROP
TABLE COURSE CASCADE CONSTRAINTS PURGE; DROP
TABLE TERM CASCADE CONSTRAINTS PURGE; DROP TABLE
STUDENT CASCADE CONSTRAINTS PURGE; DROP TABLE
FACULTY CASCADE CONSTRAINTS PURGE; DROP TABLE
LOCATION CASCADE CONSTRAINTS PURGE; STEP 2: The
CREATE TABLE statements Next, define the CREATE TABLE
statements for the seven tables that you are to create based upon the
ERD and Data Dictionary that you have been given for this lab. Be sure
to follow the guidelines given above on how and where to create the
different types of constraints for each table. STEP 3: The INSERT
statements for the data The third step is to create the insert statements to
insert the sample data into the tables created in Step 2. You might find it
helpful to take the Word document containing the sample data and save
it as a text file. After doing this, you could create the insert statements
around the actual data that is in that file. The process for doing this
should have been covered in one of the lectures for this unit. If it was
not, then ask your instructor to discuss this process with the class. STEP
4: The SELECT statements The next step of the lab will be to create the
select statements to verify the data was inserted correctly. You should
have seven select statements; one for each table. The command is
SELECT * FROM Table_Name; For example, to select all columns
from the Student table, the command would be SELECT * FROM
Student; Be sure to save all of the above statements in your script file.
STEP 5: Testing and verifying your script Now we come to the point of
verifying that your script file works by creating all of the tables and
inserting all of the data. To verify this you will need to execute your
saved script file and create an output file to capture the results being
returned to the session by using the spool COMMAND outlined in the
tutorial "Using Oracle SQL*Plus." This output file will be one of the
files you will be turning in for grading.
---------------------------------------------------------------
CIS 336 Week 4 Group Project Task 2
For more course tutorials visit
www.tutorialrank.com
Task 2 - Logical Model (30 points)
Using the Oracle SQL*Plus editor, develop a database for MiniQuest
based on your data model. The database should contain all the tables and
attributes discussed in the project specifications. Be sure to use your data
dictionary when creating your tables.
A key component to every task submission is the team responsibilities
document. This document should outline the contributions that each
member of the team made to completing the task deliverable. To submit
this task, you need to create a file in notepad called
TEAM_X_TASK2.TXT, where X is your team identifier. For example,
Team A would name the file TEAM_A_TASK2.TXT. In this file, create
a heading called CREATE STATEMENTS, and then develop the
CREATE TABLE statements required to create your database tables. Be
sure to include the DROP TABLE statements at the top of your file so
that you can reuse the file. If you include the wording CASCADE
CONSTRAINTS as part of each DROP TABLE statement, then the
order of the DROP statements will not mater. For example, to drop a
table named customer, you would state:
DROP TABLE CUSTOMER CASCADE CONSTRAINTS PURGE;
After testing and verifying that all of your create statements work, create
a spooled output file with the SET ECHO ON session command set so
that your code and the results will show.
Deliverables for this task:
Revisions of Task 1 (if any) based on feedback from your instructor.
Task 2 comprised of the CREATE TABLE script file and the output file
showing that it works. Team member responsibilities document
outlining contributions by team members to this deliverable.
---------------------------------------------------------------
CIS 336 Week 4 iLab 4 Devry University
For more course tutorials visit
www.tutorialrank.com
Lab 4 of 7: Building the Physical Model (28 points) Submit your
assignment to the Dropbox located on the silver tab at the top of this
page. For instructions on how to use the Dropbox, please click here. (See
Syllabus/"Due Dates for Assignments & Exams" for due dates.) L A B
O V E R V I E W Scenario/Summary 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 set of tables found in the
script file (LeeBooks.sql) found in the Doc Sharing area of the website.
You will need to download the file, then run the script in your SQL*Plus
session. These tables will be used for the remaining labs in this class.
The SELECT statement is the primary means of extracting data from
database tables, and allows you to determine exactly which data you
want to extract by means of different comparison operators used in the
WHERE clause. This includes the use of specific "wild card" characters
which allow you to search for character or number patterns within the
data. You can also perform mathematical expressions within the
SELECT statement to create derived output. The ORDER BY clause
allows you to sort the output data in either ascending (the default) or
descending order. Lab #4 will explore all of these applications of the
SELECT statement. General Lab Information and Considerations Each
query in the script file you will create must be numbered (use - -1
comments for numbering) and listed in order. The SQL for the following
exercises should be written using Notepad and run in SQL*Plus. Read
each problem carefully and follow the directions as stated. A Clean
Script File: A script file is meant to be like a program. The file can be
run every time the code needs to be executed without having to retype
the code again each time. For this reason, it is important that there are no
errors in the code inside the file. You can go back and forth between
Notepad and Oracle when creating your script file to check your queries
and verify if they work or not, but you do not want to create your final
output file until after you have verified that everything in your script is
correct by running it, in its entirety at least once and viewing the output.
Once this has been done, you can create your final output file, with echo
on to create the document you can turn in with your lab. Remember in
using a spool session, you must type "SPOOL OFF" at the SQL> prompt
after your script stops spooling to capture all of your data! Lab Do's and
Don’t's Do Not include the LEEBOOKS.SQL as part of your lab script.
Do use Notepad to write your query script file. Do Not write your
queries in Word. Do test each query before moving on to the next. Do
Not include extra queries for a problem unless the problem explicitly
asks for more than one query. Do test your queries before creating your
final output file. Do Not turn in a script file that has queries with errors.
Do number each query using - -1 comment notation. Do Not start your
query on the same line as the comment. Do remember to check your
final output and script file for accuracy. Do Not turn in your lab without
first checking your output file to verify that it is correct. Things to keep
in mind: If you are not sure of the table names in your user schema, you
can use the following select statement to list them. SELECT * FROM
TAB; If you want to know the name of the columns in a particular table,
you can use the following command to list them. DESC Making a script
file containing a series of describe statements for each table and then
spooling the output will give you a listing of all the tables with column
names. Be sure to review and verify your final output when you are
finished. DO NOT assume anything. Write queries for each of the stated
problems in the steps below that will return a result set of data to satisfy
the requirements. When finished, your script file should have a total of
13 queries and your resulting output file should show both the query and
result set for each. Deliverables The deliverable for this lab will include:
Your script file with the 13 queries in it. Be sure your name, course
number, and lab number are in a comment area at the top of your file.
An output file created using SET ECHO ON showing both the SQL
code and the results. Both documents are to be zipped into a single file
before submitting to the iLabDropbox for Week 4. L A B S T E P S
STEP 1: Using the BOOKS table, write a query that will list the
categories for the books in inventory. List each category only once in
your result set. STEP 2: Using the BOOKS table, write a query that will
list the title and publisher ID for each book in the table. Use the column
heading of "Publisher ID" for the pubid field. STEP 3: Using the
BOOKS table, write a query that will list the book title, retail price, and
the amount of markup for each book. The amount of markup is the retail
price minus the cost. Use the column heading “Price Markup” for the
arithmetic expression column. STEP 4: Using the BOOK_CUSTOMER
table, write a query that will list the customer’s first name, last name,
and city for those customers living in zip code 31206. STEP 5: Using the
BOOK_ORDER table, write a query that will list everything about the
orders placed prior to April 2, 2009. STEP 6: Using the BOOK_ORDER
table, write a query that will list everything about the orders that have
not been shipped yet. STEP 7: Using the BOOK_CUSTOMER table,
write a query using the AND and OR operators that will list the
customer information for those customers living in either Florida or New
Jersey who have not been referred by another customer. STEP 8: Using
the BOOKS table, write a query that will list all information about those
books that are not computer books and do not cost more than $30.00
retail. STEP 9: Using the AUTHOR table, write a query that will list all
information about authors whose first name ends with an “A”. Put the
results in descending order of last name, and then ascending order by
first name. This should be done using a single query. STEP 10: Using
the BOOK_ORDER table, write a query using the > and < operators=""
that="" will="" list="" the="" orders="" that="" were="" placed=""
between="" april="" 1,="" 2009="" and="" april="" 4,="" 2009.=""
only="" show="" the="" orders="" for="" april="" 2nd="" and=""
3rd="" in="" your="" result="" set.="" step="" 11:="" using="" the=""
book_order="" table,="" write="" a="" query="" that="" will="" list=""
the="" orders="" that="" were="" placed="" between="" april="" 2,=""
2009="" and="" april="" 4,="" 2009="" including="" those=""
placed="" on="" the="" 2nd="" and="" 4th.="" use="" a="" different=""
approach="" (operator)="" in="" writing="" this="" query="" than=""
used="" in="" the="" query="" for="" #10,="" that="" is,="" do=""
not="" use=""> and < signs="" in="" your="" query.="" step="" 12:=""
using="" the="" books="" table,="" write="" a="" query="" that=""
will="" list="" the="" book="" title,="" publisher="" id,="" and=""
published="" date="" for="" all="" books="" that="" were=""
published="" by="" publisher="" 4="" or="" after="" january="" 1,=""
2001.="" order="" the="" results="" in="" ascending="" order="" by=""
publisher="" id="" and="" give="" the="" publish="" date="" and=""
publisher="" id="" columns="" meaningful="" titles.="" step="" 13:=""
many="" organizations="" use="" percentage="" of="" markup=""
(e.g.,="" profit="" margin)="" when="" analyzing="" financial=""
data.="" to="" determine="" the="" percentage="" of="" markup=""
for="" a="" particular="" item,="" simply="" subtract="" the="" cost=""
for="" the="" item="" from="" the="" retail="" price="" to="" obtain=""
the="" dollar="" amount="" of="" profit,="" and="" then="" divide=""
the="" profit="" by="" the="" cost="" of="" the="" item.="" the=""
resulting="" solution="" is="" then="" multiplied="" by="" 100=""
to="" determine="" the="" percent="" of="" markup.="" using="" a=""
select="" statement,="" display="" the="" title="" of="" each=""
book="" and="" its="" percent="" of="" markup.="" for="" the=""
column="" displaying="" the="" percent="" of="" markup,="" use=""
“markup="" %”="" as="" the="" column="" heading.="" this="" is=""
the="" end="" of="" lab="" #4="">
---------------------------------------------------------------
CIS 336 Week 5 Group Project Task 3
For more course tutorials visit
www.tutorialrank.com
Task 3 - Verification of Logical Model(45 points)
Develop the SQL statements to insert records into the database. You
should ensure that the data in the database is sufficient to allow for each
of the reports requested by Ms. Smith to be tested. You need to show a
minimum of three insert queries for each database table that you have
created. Some tables will obviously require more to ensure that all of the
required data is in the database (i.e., the packages table, program table,
etc). To submit this task, add a comment heading called INSERT
STATEMENTS to your corrected SQL script from Task 2. Add your
INSERT statements for each table after this heading. Keep in mind that
you will need to insert data into the tables in the same order that the
tables were created. This will minimize any integrity constraint errors
you might encounter. Keep in mind also that any values being inserted
into a field defined as a foreign key field must first exist in a previous
table’s primary key field. Save the file as TEAM_X_TASK3.TXT,
where X is your team identifier. After testing your statements to verify
that your data will insert into your tables, create a spooled output file
with the SET ECHO ON session command set for submitting.
Note – Although you are only required to have three records per table in
most of your tables for this deliverable, you will need a considerable
amount of data in your tables for the final project.
After testing and verifying that all of your create statements work, create
a spooled output file with the SET ECHO ON session command set so
that your code and the results will show.
Deliverables for this task:
Any revisions of task 2 based on feedback from your instructor. Task 3
comprised of the script file containing DROP TABLE, CREATE
TABLE, and INSERT statements, and the output file showing that it
works. Team member responsibilities document outlining contributions
by team members to this deliverable.
---------------------------------------------------------------
CIS 336 Week 5 iLab 5 DevryUniversity
For more course tutorials visit
www.tutorialrank.com
Lab 5 of 7: Retreiving data from Multiple Tables (28 points) Submit
your assignment to the Dropbox located on the silver tab at the top of
this page. For instructions on how to use the Dropbox, please click here.
(See Syllabus/"Due Dates for Assignments & Exams" for due dates.) L
A B O V E R V I E W Scenario/Summary 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 write a
query using either the TRADITIONAL method of joining tables or using
the JOIN key word. In some cases, you will be asked to use a specific
approach. Using the incorrect process when the process is specified will
result in points being taken off for that problem. The SELECT statement
is the primary means of extracting data from database tables, and allows
you to determine exactly which data you want to extract by means of
different comparison operators used in the WHERE clause. This
includes the use of specific "wild card" characters which allow you to
search for character or number patterns within the data. You can also
perform mathematical expressions within the SELECT statement to
create derived output. The ORDER BY clause allows you to sort the
output data in either ascending (the default) or descending order. Lab #5
will explore all of these applications of the SELECT statement. General
Lab Information and Considerations This lab will utilize a set of tables
found in the script file (LeeBooks.sql) found in the Doc Sharing area of
the website. If you have not yet downloaded this file from Doc Sharing
then do so now. Once you have downloaded the script file, import and
run the script in SQL*Plus. Each query in the script file you will create
must be numbered (use --1 comments for numbering) and in order. The
SQL for the following exercises should be written using notepad and run
in SQL*Plus. A Clean Script File: A script file is meant to be like a
program. The file can be run every time the code needs to be executed
without having to retype the code again each time. For this reason, it is
important that there are no errors in the code inside the file. You can go
back and forth between Notepad and Oracle when creating your script
file to check your queries and verify if they work or not, but you do not
want to create your final output file until after you have verified that
everything in your script is correct by running it, in its entirety at least
once and viewing the output. Once this has been done, you can create
your final output file, with echo on to create the document you can turn
in with your lab. If using a Spool Session, be sure to type "SPOOL OFF"
AT THE SQL> after your Script Stops Spooling! Lab Do's and Don’t's
Do Not include the LEEBOOKS.SQL as part of your lab script. Do use
Notepad to write your query script file. Do Not write your queries in
Word. Do test each query before moving on to the next. Do Not include
extra queries for a problem unless the problem explicitly asks for more
than one query. Do test your queries before creating your final output
file. Do Not turn in a script file that has queries with errors. Do number
each query using --1 comment notation. Do Not start your query on the
same line as the comment. Do remember to check your final output and
script file for accuracy. Do Not turn in your lab without first checking
your output file to verify that it is correct. Things to keep in mind: If you
are not sure of the table names in your user schema, you can use the
following select statement to list them. SELECT * FROM TAB; If you
want to know the name of the columns in a particular table, you can use
the following command to list them. DESC Making a script file
containing a series of describe statements for each table and then
spooling the output will give you a listing of all the tables with column
names. Be sure to review and verify your final output when you are
finished. Do Not assume anything. Write queries for each of the stated
problems in the steps below that will return a result set of data to satisfy
the requirements. When finished, your script file should have a total of
13 queries and your resulting output file should show both the query and
result set for each. Deliverables Submit for grading: Your script file with
the 13 queries in it. Be sure your name, course number, and lab number
are in a comment area at the top of your file. Submitting ONLY your
spooled output will result in a 10-point deduction. An output file created
using SET ECHO ON showing both the SQL code and the results. Both
documents must be zipped into a single file before submitting to the
iLabDropbox for Week 5. L A B S T E P S STEP 1: Using the BOOKS
and PUBLISHER tables, create a query using the traditional join method
that will return a list containing the book title, publisher contact person,
and publisher phone number for all publishers whose publisher name
starts with an ‘R’. STEP 2: Using the DUAL table, create a query that
will return the day of the week, hour, minutes, and seconds of the
current date setting on a computer. The day should be in all upper case.
STEP 3: Using the BOOK_CUSTOMER and BOOK_ORDER tables,
create a query using the NATURAL JOIN method that will return a list
containing the customer first name and last name and the order number
for all orders that have been shipped. Give the customer name column an
alias of "Customer Name" and order the output by the customer number
in the BOOK_ORDER table in ascending order. STEP 4: Using the
BOOK_ORDER table, create a query that will return the order number,
order date, shipping address, city, state, and zip code for all orders going
to Atlanta or Austin. Format the order date to display as Month DD,
YYYY and give the column an alias of "Date Ordered". Be sure the
month begins with a capital letter. STEP 5: Using the BOOK_ORDER
table, create a query using the correct function to return the order
number, the date ordered, the date shipped, and a column representing
the number of months between the two dates for all columns where a
date shipped exists. Format the number returned from the function to
display only two decimals, and give the column an alias of "Months
Between". NOTE: Be sure that all of the numbers in the fourth column
are positive numbers. STEP 6: Using the correct tables in your schema,
create a query using either join operation that will list the title of each
book and author name(s). Give the title column an alias of "Book Title".
Sort the results by title and then by author last name. STEP 7: Using the
BOOKS table, create a query that will return the book title, cost, and
retail price for all books with a title starting with the letter ‘H’. Use the
correct conversion function to format the cost and retail columns to
show dollars and cents with a dollar sign (e.g., a price of $25 would
display $25.00 in the result set). STEP 8: Using the BOOK_ORDER,
ORDER_ITEMS, and BOOKS tables, create a query using an OUTER
JOIN operation that will list the book title, order date, and order number
for all books in the BOOKS table. Order your output in descending order
by ORDER_ITEMS.BOOKID. There are three books that have never
been ordered which should show up at the top of your listing. STEP 9:
Using the correct tables, create a query using the traditional join
operation that will list the customer first and last name, book title, and
order date (formatted as MM/DD/YYYY with an alias of “Order Date”)
for all the customers who have purchased books published by
'PRINTING IS US'. STEP 10: Using the BOOKS and ORDER_ITEMS
table, write a query using the correct Relational Set Operator that will
show all of the Book IDs in the BOOKS table that have not been
ordered. STEP 11: Using the BOOK_CUSTOMER, BOOK_ORDER,
ORDER_ITEMS, and BOOKS tables, create a query using traditional
join conditions based on comparisons between primary and foreign keys
that will list the customer number, first and last name, and book title.
Limit your listing to only those books in the ‘FITNESS’ category. STEP
12: Using the BOOKS, ORDER_ITEMS, and BOOK_ORDER tables,
create a query that will list the title, retail, quantity, and order date for all
books ordered after April 30, 2009. STEP 13: Using the correct tables,
create a query using either join operation you wish that will list the order
id, order date, quantity ordered, and retail price for every book that has
been ordered. Format the date as MM/DD/YYYY with an alias of
“Order Date” and format the retail price column using the correct
function to show dollars and cents with a dollar sign ( $ ) and a column
alias of “Retail”. This is the end of lab #5
---------------------------------------------------------------
CIS 336 Week 6 Group Project Task 4
For more course tutorials visit
www.tutorialrank.com
Task 4 - Verification of Transaction Processing (30 points)
Develop a query that will identify and mark inactive those customers
that have bills overdue by more than 30 days (this can usually be done
using a sub-query). Remember, you are only marking a customer as
inactive, not actually deleting the customer record from the system.
To submit this task, create a heading called MODIFY STATEMENTS in
your group project SQL script, and name the file
TEAM_X_TASK4.TXT. This should be the same script that contains
your DROP TABLE, CREATE TABLE, and INSERT statements. Once
you have verified that your SQL statement or statements work, create a
spooled output showing the results of your statements.
Deliverables for this task:
Any revisions of task 3 based on feedback from your instructor. Task 4
comprised of the complete script file (DROP, CREATE, INSERT,
SELECT, and UPDATE statements) and the output file showing that it
works. Team member responsibilities document outlining contributions
by team member to this deliverable.
---------------------------------------------------------------
CIS 336 Week 6 iLab 6 Devry University
For more course tutorials visit
www.tutorialrank.com
Week 6. L A B S T E P S STEP 1: Back to top Using the
BOOK_CUSTOMER table and the NVL function, create a query that
will return a list containing the customer number, first name, last name,
and the characters ‘NOT REFERRED’ if the customer was not referred
by another customer. Give the derived column an alias of REFERRED
BY. Do not list any customers that were referred by another customer.
STEP 2: Back to top Using the BOOKS table and the SUBSTR function,
create a query that will return a list of book ISBN codes and the book
title for all the computer books. Format the ISBN code to display as 9-
999-99999-9 (e.g., 1059831198 would display as 1-059-83119-8) STEP
3: Back to top Using the BOOKS table, create a query using the correct
functions to return the category name, the total retail of all books per
category with a column alias of "Total Retail", and the average retail of
all the books per category with an alias of "Average Retail" for all
categories with a total retail greater than $40.00. Format the total retail
and average retail columns using the correct function to show dollars
and cents with a dollar sign. STEP 4: Back to top Using the correct
tables in your schema, create a query using either join operation you
wish that will list the book title and number of authors for all books that
have been written by more than one author. Give the title column an
alias of "Book Title" and the column showing the number of authors an
alias of "Number of Authors". STEP 5: Back to top Using the
BOOK_AUTHOR and AUTHOR tables for the upper most query, create
a sub query that will return the BOOKID, and the first and last name of
the author(s) who have written the book(s) that have been purchased the
most. To successfully accomplish this, you will need to first find out the
maximum total number of copies (based on quantity) sold of a book
(based on bookid) in the ORDER_ITEMS table. This will be done in the
bottom most query. The return from this query will be used to compare
against the BOOKID in the ORDER_ITEMS table that occurs an equal
number of times in the middle query. The return of this query will then
be used to compare to a BOOKID related to an Author in the tables of
the top most query. (HINT: Be careful, you will need both GROUP BY
and HAVING clauses for your solution.) STEP 6: Back to top Using the
correct tables, create a sub query using either join operation you wish
that will list the customer number, first and last name concatenated
together, and city for all customers who have placed an order for the
most expensive book (based on retail price). Give the combined
customer names column and alias of "Customer Name". STEP 7: Back
to top Using the ORDER_ITEMS table, create a query using the correct
functions to return the item#, the total quantity of items ordered with an
alias of "Total", the average quantity per order with an alias of
"Average" (since averages are often in decimals, only show two decimal
places), the minimum quantity ordered with an alias of "Minimum", and
the maximum quantity ordered with an alias of "Maximum". Your
output results set should have five columns and four rows of data. STEP
8: Back to top Using the BOOKS table, create a query using the
DECODE function that will display the book title, the published date,
and the publisher name (this is where the decode function comes in).
Give the publisher name column an alias of "Publisher Name", and order
the publisher names in descending order. The publisher names used
should be the same as those in the PUBLISHER table. DO NOT join to
the Publisher table for this query. STEP 9: Back to top Using the
PUBLISHER table, create a query that will return a line of output like
the one below for each record in the table. Be sure to use the correct
functions in the SELECT statement, so that your output looks like the
example below. The contact person for Printing Is Us Publishing is
Tommie Seymour. Be sure to use the correct function to display the
publisher name and publisher contact with only the first letter of each
word capitalized. STEP 10: Back to top Using the correct tables, create a
query using the JOIN ON method to display a listing of all customers
who have purchased more than two books. List the customer’s last
name, the customer’s city and state, and the number of books they have
purchased. Give the number purchased column and alias of "Number
Purchased". STEP 11: Back to top Using only the BOOK table for the
upper most statement, create a sub query that will update the retail price
of all books published by PRINTING IS US by five percent (retail *
1.05). Remember, all you have is the publisher "name". Use the sub
query to find the publisher ID. To verify your update, provide a select
statement on the BOOKS table before your update statement, and then a
second select on the BOOKS table after the update. Once you have
verified the results, you can issue a ROLLBACK statement to return the
data to the original state. STEP 12: Back to top Using the
BOOK_CUSTOMER table, write a sub query that will return the names
of those customers who were referred by the same individual who
referred Jorge Perez. Do not display Jorge Perez’s name in the returned
results (Hint: you should only have two customers displayed and the
exclusion for Jorge Perez must be associated with the upper query).
STEP 13: Back to top Using the BOOKS table, create a query using the
correct functions to return the category name, total number books per
category with a column alias of "Category Total", and the total cost of
all the books per category with an alias of "Cost". Format the cost
column using the correct function to show dollars and cents with a dollar
sign. This is the end of Lab #6 Back to top]HTML
---------------------------------------------------------------
CIS 336 Week 7 Group Project Task 5
For more course tutorials visit
www.tutorialrank.com
Develop the queries to support each of the reports that are required by
Ms. Smith. It is expected that the information returned by the queries is
adequate to be used in the reporting process. Make sure your output
contains enough information! The following is a recommendation and
the MINIMUM amount of data you should have access to:
Customer Table: A minimum of 12 customers (this will allow several
channels to have more than one customer selecting it as a favorite
channel) Billing Table: Records to support the above customers Program
Table: A minimum of 25 programs (your program guide should have
enough programs for various channels to support the program guide
report) Other tables: A sufficient amount of data to support the above
when reports are run
Create a heading of REPORTING STATEMENTS as a comment at the
bottom of your group project database script file. Add the six report
queries to this area. In instances where you are asked to allow for user
input, please specify an appropriate value based upon the data in your
script. For example, Report 1 is a DATE driven report; therefore, you
should use a single date in your WHERE clause to display the
information. Task 5 is the final task for the project and is designed to
demonstrate that you have adequately satisfied the requirements of the
project. The following is what you are to submit for Task 5:
Report 1 – A list of the programs on all channels for a specific day
showing the channel number, supplier, package, program name, rating
code, and show time. This will be similar to a program guide, only not
package specific. This is a date-driven report, therefore it should only
display programs for a single date specified. Report 2 – A sample
program guide showing the channel number, show time, program name,
and rating description. For the purposes of this project, your report
should be package ID specific (based on a given package ID) and you
only need to demonstrate a single package ID. Your report should
include all channels associated with the specified package. Report 3 – A
list of all new customers signed up on a specific day. This should show
enough details about the customer, including favorite channel, address,
and minimal billing details. This report is to be date driven, so you will
need to specify a date in your query. Report 4 – A list of all the
customers made inactive on a specific date. This should show enough
details about the customer to allow contact with the customer, the reason
he or she was made inactive, and the user who made them inactive.
Again, keep in mind that this is a date driven report. Report 5 – A list of
each channel (both channel name and channel number) and a count of
the number of customers who picked that channel as a favorite channel.
Report 6 – A summary of sales for any given day, categorized by
package type (i.e., the total sales written on the specified day for each
package subscribed to by customers, not bills paid). This report should
give details about each package type, the package price, the number of
packages sold, and then the total sales amount for that package. Once
again, remember that this is going to be a date driven report.
---------------------------------------------------------------
CIS 336 Week 7 iLab 7 Devry University
For more course tutorials visit
www.tutorialrank.com
L A B O V E R V I E W Scenario/Summary 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. Being able to enhance the efficiency of the database
tables by using additional indexes is also a very important aspect of
database development. Finally, being able to create and use
Database Sequences to automate some of the sequential processes in
the database can not only save time but improve efficiency. In Lab
7, you will have a chance to work with all three of these areas.
General Lab Information and Considerations This lab will utilize
the same set of tables found in the script file (LeeBooks.SQL) that
were used for Labs 4 through 6. Each query in the script file you
will create, must be numbered (use either –1 or REM 1 comments
for numbering) and in order. The SQL for the following exercises
should be written using notepad and run in SQL*Plus. Read each
problem carefully and follow the directions as stated. A Clean Script
File: A script file is meant to be like a program. The file can be run
every time the code needs to be executed without having to retype
the code again each time. For this reason, it is important that there
are no errors in the code inside the file. You can go back and forth
between notepad and Oracle when creating your script file to check
your queries and verify if they work or not. However, you do not
want to create your final output file until after you have verified
that everything in your script is correct by running it in its entirety
at least once and viewing the output. Once this has been done, you
can create your final output file, with echo on to create the
document, you can turn in with your lab. Remember in using a
Spool Session, you must type "SPOOL OFF" at the SQL>
PROMPT after your Script stops spooling to capture all of your
data! Lab Do's and Don't's Do Not include the LEEBOOKS.SQL as
part of your lab script. Do use Notepad to write your query script
file. Do Not write your queries in Word. Do test each query before
moving on to the next. Do Not include extra queries for a problem
unless the problem explicitly asks for more than one query. Do test
your queries before creating your final output file. Do Not turn in a
scrip file that has queries with errors. Do number each query using
either --1 or REM 1 comment notation. Do Not start your query on
the same line as the comment. Do remember to check your final
output and script file for accuracy. Do Not turn in your lab without
first checking your output file to verify that it is correct. Things to
keep in mind: If you are not sure of the table names in your user
schema, you can use the following select statement to list them.
SELECT * FROM TAB; If you want to know the name of the
columns in a particular table, you can use the following command to
list them. DESC Making a script file containing a series of describe
statements for each table and then spooling the output will give you
a listing of all the tables with column names. Be sure to review and
verify your final output when you are finished. Do Not assume
anything. Write queries for each of the stated problems in the steps
below that will return a result set of data to satisfy the requirements.
When finished, your resulting output file should show both the
query statement and result set for each query. Deliverables The
deliverable for this lab will include: Your script file with the seven
queries and oneexplanation in it. Be sure your name, course
number, and lab number are in a comment area at the top of your
file. An output file created using SET ECHO ON showing both the
SQL code and the results. Be sure that you include your answer to
question #3 as a comment in this file. Both documents are to be
zipped into a single file before submitting to the iLabDropbox for
Week 7. L A B S T E P S STEP 1: Create a simple view named
CUST_VIEW using the book_customer table that will display the
customer number, first and last name, and the state for every
customer currently in the database. Now insert the following data
into the book_customer TABLE using an INSERT statement. (Do
not use the View for this insert.) CUSTOMERID - 1021,
FIRSTNAME – EDWARD, LASTNAME – BLAKE, STATE – TX.
Now query your view and display the new record. STEP 2: Create a
complex view named CUST_ORDER that will list the customer
number, last name, and state from the BOOK_CUSTOMER table,
in addition to the order number and order date from the
BOOK_ORDER table. Insert the following data into this view (use
the view for the insert statement): CUSTOMERID - 1022,
LASTNAME – smith, STATE – KS, ORDERID - 1021, and
ORDERDATE – 10-OCT-2004. STEP 3: In your own words,
explain why the insert statement for the view you created in Step 2
did not work. STEP 4: Create a sequence that can be used to assign
a publisher ID number to a new publisher. Define the sequence to
start with seven, increment by two, and stop at 1000. Name the
sequence PUBNUM_SEQ. STEP 5: Insert two new publishers into
the PUBLISHER table, one named Double Week with a contact
name of Jennifer Close at 800-959-6321, and the second one named
Specific House with a contact name of Freddie Farmore at 866-825-
3200. Use your new sequence to create the PUBID for each record.
Now, query your PUBLISHER table to see your two new records.
STEP 6: Using a single query, query the PUBNUM_SEQ to
determine what both the current sequence number is and the next
sequence number will be. STEP 7: Create a unique index on the
combined columns ORDERID and CUSTOMERID in the
BOOK_ORDER table. Give the index a name of
BOOK_ORDER_IDX. STEP 8: Determine how many objects you
currently own in your schema by querying the USER_OBJECTS
view in the Data Dictionary. Your result set should list the different
object types that you find and include a count by object type.
---------------------------------------------------------------

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

CIS 336 STUDY Become Exceptional--cis336study.com
CIS 336 STUDY Become Exceptional--cis336study.comCIS 336 STUDY Become Exceptional--cis336study.com
CIS 336 STUDY Become Exceptional--cis336study.com
 
CIS 336 STUDY Education Counseling--cis336study.com
CIS 336 STUDY Education Counseling--cis336study.comCIS 336 STUDY Education Counseling--cis336study.com
CIS 336 STUDY Education Counseling--cis336study.com
 
CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   
 
CIS 336 PAPERS Lessons in Excellence--cis336papers.com
CIS 336 PAPERS Lessons in Excellence--cis336papers.comCIS 336 PAPERS Lessons in Excellence--cis336papers.com
CIS 336 PAPERS Lessons in Excellence--cis336papers.com
 
CIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.comCIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.com
 
CIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.comCIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.com
 
CIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.comCIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.com
 
CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   
 
Cis 336 Enhance teaching / snaptutorial.com
Cis 336    Enhance teaching / snaptutorial.comCis 336    Enhance teaching / snaptutorial.com
Cis 336 Enhance teaching / snaptutorial.com
 
CIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.comCIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.com
 
CIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.comCIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.com
 
CIS 336 STUDY Inspiring Innovation--cis336study.com
CIS 336 STUDY Inspiring Innovation--cis336study.comCIS 336 STUDY Inspiring Innovation--cis336study.com
CIS 336 STUDY Inspiring Innovation--cis336study.com
 
CIS 336 STUDY Education Begins--cis336study.com
CIS 336 STUDY Education Begins--cis336study.comCIS 336 STUDY Education Begins--cis336study.com
CIS 336 STUDY Education Begins--cis336study.com
 
Advanced SQL injection to operating system full control (slides)
Advanced SQL injection to operating system full control (slides)Advanced SQL injection to operating system full control (slides)
Advanced SQL injection to operating system full control (slides)
 
CIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.comCIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.com
 
SQL injection exploitation internals
SQL injection exploitation internalsSQL injection exploitation internals
SQL injection exploitation internals
 
References
References References
References
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injection
 
Not so blind SQL Injection
Not so blind SQL InjectionNot so blind SQL Injection
Not so blind SQL Injection
 
SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)
 

Ähnlich wie CIS 336 Education guide/Tutorialrank.com

Ähnlich wie CIS 336 Education guide/Tutorialrank.com (18)

Cis 336 final exam 1
Cis 336 final exam 1Cis 336 final exam 1
Cis 336 final exam 1
 
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)
CIS 336 Final Exam 2 (Devry) CIS 336 Final Exam 2 (Devry)
CIS 336 Final Exam 2 (Devry)
 
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
 
CIS 336 Final Exam 2 (Devry)p
CIS 336 Final Exam 2 (Devry)pCIS 336 Final Exam 2 (Devry)p
CIS 336 Final Exam 2 (Devry)p
 
Cis 336 final exam 2
Cis 336 final exam 2Cis 336 final exam 2
Cis 336 final exam 2
 
CIS 336 Final Exam (Feb 2016)p
CIS 336 Final Exam (Feb 2016)pCIS 336 Final Exam (Feb 2016)p
CIS 336 Final Exam (Feb 2016)p
 
Apps1
Apps1Apps1
Apps1
 
Using AWR for SQL Analysis
Using AWR for SQL AnalysisUsing AWR for SQL Analysis
Using AWR for SQL Analysis
 
CIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.comCIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.com
 
CIS 115 Effective Communication - tutorialrank.com
CIS 115  Effective Communication - tutorialrank.comCIS 115  Effective Communication - tutorialrank.com
CIS 115 Effective Communication - tutorialrank.com
 
The Hidden Face of Cost-Based Optimizer: PL/SQL Specific Statistics
The Hidden Face of Cost-Based Optimizer: PL/SQL Specific StatisticsThe Hidden Face of Cost-Based Optimizer: PL/SQL Specific Statistics
The Hidden Face of Cost-Based Optimizer: PL/SQL Specific Statistics
 
Dimensional performance benchmarking of SQL
Dimensional performance benchmarking of SQLDimensional performance benchmarking of SQL
Dimensional performance benchmarking of SQL
 
Dbm 438 Enthusiastic Study / snaptutorial.com
Dbm 438 Enthusiastic Study / snaptutorial.comDbm 438 Enthusiastic Study / snaptutorial.com
Dbm 438 Enthusiastic Study / snaptutorial.com
 
Dbm 438 Success Begins / snaptutorial.com
Dbm 438  Success Begins / snaptutorial.comDbm 438  Success Begins / snaptutorial.com
Dbm 438 Success Begins / snaptutorial.com
 
Dbm 438 Success Begins / snaptutorial.com
Dbm 438  Success Begins / snaptutorial.comDbm 438  Success Begins / snaptutorial.com
Dbm 438 Success Begins / snaptutorial.com
 
DBM 438 Technology levels--snaptutorial.com
DBM 438 Technology levels--snaptutorial.comDBM 438 Technology levels--snaptutorial.com
DBM 438 Technology levels--snaptutorial.com
 
Cis 115 Education Organization / snaptutorial.com
Cis 115 Education Organization / snaptutorial.comCis 115 Education Organization / snaptutorial.com
Cis 115 Education Organization / snaptutorial.com
 

Kürzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

CIS 336 Education guide/Tutorialrank.com

  • 1. CIS 336: All iLabs Week 1 to Week 7: Devry University For more course tutorials visit www.tutorialrank.com CIS 336: All iLabs Week 1 to Week 7: Devry University --------------------------------------------------------------- CIS 336 Entire Course: Devry University For more course tutorials visit www.tutorialrank.com CIS 336 Entire Course: Devry University --------------------------------------------------------------- CIS 336 Final Exam 1
  • 2. For more course tutorials visit www.tutorialrank.com 1. (TCO 1) Most DBMS are referred to as _____________database management systems. (Points : 4) elemental linked hierarchical relational 2. (TCO 1) Data constitutes the building blocks of _____________. (Points : 4) information processing applications programming 3. (TCO 2) If a foreign key contains either matching values or nulls, the table(s) that make use of such a foreign key is/are said to exhibit __________ integrity. (Points : 4) referential restrictive secondary redundant
  • 3. 4. (TCO 2) In a "one-to-many" relationship, which constraint is usually added to the "many" table? (Points : 4) UNIQUE PRIMARY KEY FOREIGN KEY NOT NULL 5. (TCO 3) A ____ occurs when a relationship is improperly or incompletely identified and, therefore, is represented in a way that is not consistent with the real world. (Points : 4) surrogate primary keys time-variant data design trap fan trap 6. (TCO 3) All of the following are true about a prime attribute except_____________. (Points : 4) it is a key attribute it is at least part of a key it is not a key attribute it may be part of a composite key 7. (TCO 3) The conflicts between design efficiency, information requirements, and processing speed are often resolved through_____________. (Points : 4) conversion from 1NF to 2NF conversion from 2NF to 3NF
  • 4. compromises that include denormalization conversion from 3NF to 4NF 8. (TCO 4) When a constraint is created at the ______ level with the CREATE TABLE command, the constraint definition is simply included as part of the column definition.(Points : 4) table column database row Page 2 - Multiple Choice 1. (TCO 4) In Oracle, the CONSTRAINT clause is used to ___________________. (Points : 4) create only referential constraints define and name any constraint create a short cut so the constraint does not have to be named create only entity entegrity constraints 2. (TCO 4) The SQL command that lets you list the table contents is (Points : 4) insert. select. commit. update. rollback. 3. (TCO 5) The Crow's Foot model is more ___________-oriented than the Chen model. (Points : 4)
  • 5. object user implementation processor 4. (TCO 5) The ___________ model is both software and hardware dependent. (Points : 4) conceptual logical condensed physical 5. (TCO 6) Which of the following commands will add a new column named FIRSTORDERDATE to the CUSTOMERS table to store the date that the customer first placed an order with the company? (Points : 4) CREATE COLUMN firstorderdate, DATE TO customers; ALTER TABLE customers ADD COLUMN firstorderdate DATE; ALTER TABLE customers ADD firstorderdate DATE; ALTER TABLE customers ADD (firstorderdate DATE); 6. (TCO 6) When modifying the data characteristics of a column in Oracle, which of the following is correct? (Points : 4) The column size can be increased. The size of the column can be decreased. Changing the default value of a column will change the values of data already in a table. If a NUMBER column is empty, its precision and scale cannot be changed.
  • 6. 7. (TCO 6) Which of the followig SQL commands would alter the table DEVRY and add a foreign key that references the CITY table? (Points : 4) ALTER table DEVRY ADD CONSTRAINT devry_studentcity_fk references city; ALTER table DEVRY ADD CONSTRAINT devry_studentcity_fk FOREIGN KEY references city; ALTER table DEVRY ADD CONSTRAINT devry_studentcity_fk FOREIGN KEY (student_city) references city; ALTER table DEVRY ADD CONSTRAINT FOREIGN KEY (student_city) references city; 8. (TCO 7) Given a table named EMPLOYEE, the SQL command to sort records in a specific order would be: (Points : 4) SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE LIST BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM EMPLOYEE DISPLAY BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL,
  • 7. EMP_AREACODE, EMP_PHONE FROM EMPLOYEE SEQUENCE BY EMP_LNAME, EMP_FNAME, EMP_INITIAL; Page 3 - Multiple Choice 1. (TCO 7) Which of the following subqueries returns more than one row of results to the outer query? (Points : 4) multiple-column subquery single-row subquery multiple-row subquery correlated subquery 2. (TCO 7) Which of the following keywords can be used to join two tables that do not contain a commonly named and defined column? (Points : 4) NATURAL JOIN JOIN...ON JOIN...USING JOIN...WHERE 3. (TCO 8) Based upon the contents of the BOOKS table shown below, which of the following SQL statements will return the number of categories contained in the table? (Points : 4) SELECT COUNT(DISTINCT category) FROM books; SELECT DISTINCT COUNT(category) FROM books; SELECT DISTINCT (COUNT(category)) FROM books; SELECT DISTINCT COUNT(category) FROM books;
  • 8. 4. (TCO 8) The _____________ function can be used to display upper- case characters in lower-case. (Points : 4) CONVERT MIN LESS LOWER 5. (TCO 8) Which of the following statements will produce the value 21.1? (Points : 4) SELECT ROUND(21.12, 1) FROM dual; SELECT ROUND(21.12, -1) FROM dual; SELECT ROUND(21.12, 0) FROM dual; SELECT ROUND(21.12, 0+) FROM dual; 6. (TCO 9) The column to be updated by the UPDATE command is specified in the ______ clause. (Points : 4) UPDATE SET WHERE COL 7. (TCO 9) If the INSERT INTO command is used to insert data values that violate an existing constraint in a table, which of the following will happen. (Points : 4) Oracle will raise an error and you will have to go update the incorrect data. Oracle will raise an error and the entire row will be rejected. Oracle will raise an error and the invalid piece of data will be rejected.
  • 9. Oracle will raise and error and all current transactions will be rolled back. 8. (TCO 10) Which of the following commands is used to establish a user account? (Points : 4) CREATE NEW USER username IDENTIFIED BY password; CREATE USERNAME username IDENTITY password; CREATE USER username PASSWORD password; CREATE USER username IDENTIFIED BY password; 9. (TCO 10) Which command will grant a system privilege to a user? (Points : 4) GRANT systemprivilegeUSERNAME username GRANT PRIVILEGE systemprivilegeTO username GRANT systemprivilegeTO username GRANT systemprivilege ON username --------------------------------------------------------------- CIS 336 Final Exam 2 For more course tutorials visit www.tutorialrank.com
  • 10. 1. (TCO 1) Most DBMS are referred to as _____________database management systems. (Points : 4) elemental linked hierarchical relational 2. (TCO 1) A relational DBMS provides protection of the _______________________ through security, control, and recovery facilities. (Points : 4) user network system database 3. (TCO 2) If a foreign key contains either matching values or nulls, the table(s) that make use of such a foreign key is/are said to exhibit __________ integrity. (Points : 4) referential restrictive secondary redundant 4. (TCO 2) A field that consists of integer values is a _________ type field. (Points : 4)
  • 11. Date/Time Yes/No Memo Numeric 5. (TCO 3) The PK must uniquely identify each entity instance. A primary key must be able to guarantee unique values. It cannot contain nulls. This rationale belongs to ____. (Points : 4) Unique values Nonintelligent Preferably single-attribute Security complaint 6. (TCO 3) A table that is in 1NF and includes no partial dependencies only is said to be in_____________. (Points : 4) 1NF. 2NF. 3NF. 4NF. BCNF. 7. (TCO 3) A table that has all key attributes defined, has no repeating groups, and all its attributes are dependent on the primary key, is said to be in_____________.(Points : 4) 1NF. 2NF. 3NF. 4NF. BCNF.
  • 12. 8. (TCO 4) In Oracle, the DEFAULT constraint is used to ____________________. (Points : 4) define which column is the default primary key if one is not explicitly named define which column is the default foreign key if on is not explicitly named assign a value to an attribute when a new row is added and a value is not defined validate data when a value is added to an attribute Page 2 - Multiple Choice 1. (TCO 4) Which of the following is not considered a database object? (Points : 4) a table a view a constraint a sequence an index 2. (TCO 4) Which of the following SQL statements would you use to create a table named DEVRY? (Points : 4) CREATE Devry ( Student_id NUMBER (12), Student_name VARCHAR2 (15), Student_city VARCHAR2 (12) ); CREATE TABLE Devry
  • 13. ( Student_id NUMBER (12) Student_name VARCHAR2 (15) Student_city VARCHAR2 (12) ); CREATE TABLE Devry ( Student_id NUMBER (12), Student_name VARCHAR2 (15), Student_city VARCHAR2 (12) ); CREATE TABLE Devry Student_id NUMBER (12), Student_name VARCHAR2 (15), Student_city VARCHAR2 (12); 3. (TCO 5) The ____ constraint requires that a specific condition be met before a record can be added to a table. (Points : 4) UNIQUE REFERENCE CONDITION CHECK 4. (TCO 5) The ___________ model is both software and hardware dependent. (Points : 4) conceptual logical condensed physical
  • 14. 5. (TCO 6) The _________________________ statement can be used to enable or disable a constraint. (Points : 4) alter table modify table create table update table 6. (TCO 6) When using the ALTER TABLE...DROP COLUMN command, which of the following is not correct? (Points : 4) The command's effect on the table is permanent. You cannot delete the last remaining column in a table. The command deletes both the column and its contents. The command can be used to delete multiple columns from a table. 7. (TCO 6) Which of the following keywords can be used to change the size, datatype, and/or default value of an existing column? (Points : 4) ADD MODIFY CHANGE RESET 8. (TCO 7) Any type of subquery can be used in the _________ clause of a SELECT statement. (Points : 4) WHERE HAVING FROM ORDER BY GROUP
  • 15. Page 3 - Multiple Choice 1. (TCO 7) Using the BOOK_CUSTOMER and BOOK_ORDER tables shown below for references, which SQL statement will return the same results as the following SQL statement? SELECT * FROM book_customer, book_order; (Points : 4) SELECT * FROM book_order CROSS JOIN book_customer; SELECT * FROM book_order, book_customer WHERE book_order.customer# = book_customer.customer#; SELECT * FROM book_order, book_customer WHERE book_order.customer# >book_customer.customer#; SELECT * FROM o book_order , c book_customer WHERE o.customer# = c.customer#; 2. (TCO 7) If a Cartesian join is used to link table A which contains five rows to table B which contains eight rows, there will be _______ rows in the results. (Points : 4) 8 13 5 40 3. (TCO 8) Based upon the contents of the BOOK_ORDER table shown below, which of the following SQL statements will display the ship date for order 1006 as April 2, 2002? (Points : 4)
  • 16. SELECT order#, TO_CHAR(shipdate, 'fmMonth DD, YYYY') FROM book_order; SELECT order#, TO_DATE(shipdate, 'fmMonth DD, YYYY') FROM book_order; SELECT order#, TO_CHAR(shipdate, 'Month DD, YYYY') FROM book_order; SELECT order#, TO_DATE(shipdate, 'Month DD, YYYY') FROM book_order; 4. (TCO 8) Based upon the contents of the BOOK_ORDER table shown below, which of the following SQL statements will display only those orders shipped to the zip code zone that begins with 323? (Points : 4) SELECT order#, SUBSTR(shipzip, 1, 323) FROM book_order; SELECT order#, SUBSTR(shipzip, 1, 323) FROM book_order WHERE ; SELECT order# FROM book_order WHERE (shipzip, 1, 323); SELECT order# FROM book_order WHERE SUBSTR(shipzip, 1, 3) = 323; 5. (TCO 8) Which of the following functions determines the number of characters in a character string? (Points : 4) COUNT NUMBER
  • 17. LENGTH DECODE 6. (TCO 9) Which of the following is not a valid SQL command? (Points : 4) UPDATE acctmanager SET WHERE ; UPDATE acctmanager SET (amname); UPDATE acctmanager SET (amname) WHERE ; UPDATE acctmanager WHERE ; 7. (TCO 9) Using the promotion table shown below, which of the following SQL statements will insert a new row into the PROMOTION table? (Points : 4) INSERT INTO promotion (gift, minretail, maxretail) VALUES (FREE BOOK, 75.01, 89.99); INSERT INTO promotion (gift, minretail, maxretail) VALUES ('FREE BOOK', 75.01, 89.99); INSERT INTO promotion VALUES (FREE BOOK, 75.01, 89.99); INSERT INTO promotion (gift, minretail) VALUES (FREE BOOK, 75.01, 89.99); 8. (TCO 10) A ____ is a uniquely identifiable object that allows a given person to log on to the database. (Points : 4) user role
  • 18. profile manager 9. (TCO 10) Which command will delete a user account from Oracle9i? (Points : 4) DELETE USER username; DELETE USER username IDENTIFIED BY password; DROP USER username IDENTIFIED BY password; DROP USER username; Page 4 - Essays 1. (TCO 2) What is Character data? (Points : 15) 2. (TCO 3) Explain the term "second normal form". (Points : 15) 3. (TCO 7) Sally needs to find all employees who have a date-of-hire between 01-JAN-2003 and 01-JAN-2005. She writes and executes the following query: 4. (TCO 8) In using group functions we cannot place a group function in a WHERE clause. Explain how the WHERE clause and HAVING clause are similar and why you can use the HAVING with a group function but not a WHERE clause. (Points : 15) 5. (TCO 6) Write the SQL statement that will remove the database table EMPLOYEE. (Points : 15) 1. (TCO 7) Write a join query using NATURAL JOIN that for every order in the ORDERS table will list the order number and order date along with the cusnumber, last name, and first name of the customer who placed the order.
  • 19. 2. (TCO 8) Write a query that will list the part number, part description, and on-hand value (units on hand * unit price) for each part in item class AP. Give the expression an alias of "On Hand Value". 3. (TCO 8) Write a sub query that will list the part number, part description, and units on hand of all parts where the number of units on hand is greater than the average of units on hand for all parts. 4. (TCO 7) Using the BETWEEN operator, write a query that will list all details about all orders that were placed during the period of September 3rd thru September 5th of 1998. 5. (TCO 7) Write a query that will list the part number and part description for all parts in the PART table. (Points : 15) --------------------------------------------------------------- CIS 336 Final Exam 3 For more course tutorials visit www.tutorialrank.com 1. (TCO 2) Explain what physical independence means. (Points : 15) 2. (TCO 8) Sally wants to query the EMP table and determine how many of the employees live in each of the cities the company has factories in.
  • 20. She writes the following query but it does not work. What is wrong with the way the query is constructed? 3. (TCO 3) Explain in what two specific cases presented in the text composite primary keys are particularly useful. (Points : 15) 4. (TCO 7) How are comparisons done on character string data in a queries WHERE clause, and why would this be especially useful in comparing certain attributes? (Points : 15) 5. (TCO 6) Oracle will not allow the changing of a column's data type unless the column is empty, and even then it may still be prohibited. Discuss why? (Points : 15) 6. (TCO 7) Write a join query using NATURAL JOIN that for every order in the ORDERS table will list the order number and order date along with the cusnumber, last name, and first name of the customer who placed the order. 7. (TCO 8) Write a query that will list the part number, part description, and on-hand value (units on hand * unit price) for each part in item class AP. Give the expression an alias of "On Hand Value". 8. (TCO 8) Write a query that will display the customer number, first name, and last name for every customer with a balance greater than $50. Display the first and last name as a single column and provide an alias for the column. 9. (TCO 7) Write a query that will list the customer number, last name, and first name for every customer represented by sales rep 03 or sales rep 12.
  • 21. 10. (TCO 7) Write a query that will list the customer first and last name and the sales rep commission rate using JOIN ON. --------------------------------------------------------------- CIS 336 Final Exam 4 Sets of Answers For more course tutorials visit www.tutorialrank.com CIS 336 Final Exam 4 Sets of Answers --------------------------------------------------------------- CIS 336 Final Exam 4 For more course tutorials visit www.tutorialrank.com 1. (TCO 7) For every order, list the order number, order date, part number, part description, and item class for each part that makes up the order. 2. (TCO 8) Write a query that will display the customer number, last name, and first name for every customer I whose first name begins with the letter "D".
  • 22. 2. (TCO 8) Write a query that will display the earliest date an order was placed. 3. (TCO 7) Using the BETWEEN operator, write a query that will list all details about all orders that were placed during the period of September 3rd thru September 5th of 1998. 5. (TCO 7) Write a query that will list the customer first and last name and the sales rep commission rate using JOIN ON. --------------------------------------------------------------- CIS 336 Quiz 1 For more course tutorials visit www.tutorialrank.com (TCO 3) Normalization works through a series of stages called normal forms. Typically _________ stages must be completed before a table can be considered normalized. (TCO 3) The conflicts between design efficiency, information requirements, and processing speed are often resolved through (TCO 3) The PK must uniquely identify each entity instance. A primary key must be able to guarantee unique values. It cannot contain nulls. This rationale belongs to
  • 23. (TCO 9) The SQL command that lets you insert data into a table, one row at a time, is _____________. (TCO 4) Which command is used to restore the table's contents to their default values? (TCO 4) Which of the following SQL commands would alter the table DEVRY and add a foreign key that references the CITY table? (TCO 4) The SQL command that lets you save your work to disk, is ___________ (TCO 9) If the INSERT INTO command is used to insert data values that violate an existing constraint in a table, which of the following will happen? (TCO 3) Explain under what circumstances a partial dependency can exist in a database. --------------------------------------------------------------- CIS 336 Quiz 2 For more course tutorials visit www.tutorialrank.com (TCO 2) Explain what a composite attribute is
  • 24. (TCO 1) Data constitutes the building blocks of (TCO 1) Successful database design is first and foremost based on _____________ requirements. (TCO 1) The lowest level in a database hierarchy is the ____________ or value as it is often referred (TCO 2) The term _____________ design is used to refer to the task of creating the conceptual data model represented by an Entity Relationship Diagram (ERD). (TCO 2) Within a table, the primary key must be unique so that it will identify each row. When this is the case, the table is said to exhibit ___________. (TCO 2) A field that consists of data values that can be used for arithmetic procedures is a _________ type field. (TCO 2) A relationship is an association between ___________ (TCO 5) The _____________ model represents a global view of the data. (TCO 5) In Crow's Foot notation, a forked end means --------------------------------------------------------------- CIS 336 Quiz 3 For more course tutorials visit www.tutorialrank.com
  • 25. (TCO 7) Which of the following types of columns will automatically right-align the data when it is displayed? (TCO 7) Which of the following SQL statements will display the profit generated by each book currently stored in the BOOKS table? (You do not need to see the table structure for this question) (TCO 7) Which of the following will display the new retail price of each book as 20 percent more than it originally cost? (TCO 7) Which of the following operators would be most appropriate to determine whether or not the retail price of a book is at least $24.00? (TCO 7) The ______________________ comparison operator is used to indicate that a data value must fall within a range of values to be included in the query results. (TCO 7) Based upon the contents of the BOOK_ORDER table shown below, which of the following queries will display all orders that were not shipped for at least three days after the order was received? (TCO 7) ANSI-standard SQL allows the use of a special operator in conjunction with WHERE clause. A special operator used to check whether an attribute matches one from a subquery is_______. (TCO 7) A ____ occurs when a relationship is improperly or incompletely identified and, therefore, is represented in a way that is not consistent with the real world. (TCO 7) The ______________________ comparison operator is used to search for values which are not NULL.
  • 26. TCO 7) You want to write a query that will return the customer number, first and last name from the book_order table (shown below) for all customers who have a P.O. Box and who live in either Trenton or Chicago. Write the query that will accomplish this task. --------------------------------------------------------------- CIS 336 Quiz 4 For more course tutorials visit www.tutorialrank.com (TCO 8) If a Cartesian join is used to link table A which contains five rows to table B which contains eight rows, there will be _______ rows in the results. (TCO 8) Which of the following statements will produce the value 21.1? (TCO 8) Which of the following format elements will display insignificant leading zeros? (TCO 8) Oracle’s pseudo table used only for cases where a table is not really needed is _________? (TCO 7) Using the BOOK_CUSTOMER and BOOK_ORDER tables shown below for reference which SQL statement will return the same results as the following SQL statement?
  • 27. (TCO 7) A table alias or qualifier cannot be assigned in the FROM clause of which type of join? (TCO 7) The _______ query joins a table to itself using aliases to distinctly identify each instance of the table. (TCO 7) Explain the difference between an inner join and an outer join. --------------------------------------------------------------- CIS 336 Quiz 5 For more course tutorials visit www.tutorialrank.com (TCO 6) Which of the following keywords is used to remove a row in a table? (TCO 6) When using the ALTER TABLE...DROP COLUMN command, which of the following is NOT correct? (TCO 6) Which of the following commands will add a new column named FIRSTORDERDATE to the CUSTOMERS table to store the date that the customer first placed an order with the company? (TCO 8) Which of the following is NOT a valid statement? (TCO 8) Based on the contents of the BOOKS table shown below, which of the following SQL statements will return the total profit generated by books in the COOKING category?
  • 28. (TCO 8) Which comparison operator evaluates a subquery and if it returns false, will not execute the calling query? (TCO 8) The following SQL statement contains which type of subquery? (TCO 9) If the _________ clause of the UPDATE command is omitted, then all the rows in the specified table will be changed. (TCO 9) Which of the following is not a valid SQL command? (TCO 9) Based on the contents of the PROMOTION table, which of the following commands will delete only the row for the Free Bookmark from the table? (TCO 8) In using group functions we cannot place a group function in a WHERE clause. Explain how the WHERE clause and HAVING clause similar and why you can use the HAVING with a group function but not a WHERE clause. --------------------------------------------------------------- CIS 336 Week 1 iLab 1 Devry University For more course tutorials visit www.tutorialrank.com L A B O V E R V I E W 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
  • 29. 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
  • 30. 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. L A B S T E P S 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
  • 31. 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? OrdNoOrdDateCustNoEmpNo 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. --------------------------------------------------------------- CIS 336 Week 2 iLab 2 Devry University For more course tutorials visit www.tutorialrank.com Lab two introduces the next step in creating a data model, the Entity Relationship Diagram (ERD). You will be given a business scenario for a company named Clapham Specialty Store, which is a small specialist grocery and delicatessen. 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 which lists
  • 32. 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. If there is not a single word that will apply, then supply a separate name for each direction of the relationship. Narrative/Case Study The Clapham Specialty Store is a small, specialist grocery and delicatessen. A new owner, John Balfour, who would like to expand the store and improve its profits, has recently purchased the store. The store sells general groceries, wines and liquors, and has a small deli counter. The store is open from 5:00 a.m. to 12:00 midnight. Many of the customers are repeat customers who come in to buy products they forgot from their regular grocery shopping expedition at the supermarket. The store sells about 3,000 different products ranging from toilet cleaner to 2 oz. jars of caviar, and champagne to liverwurst. Each product is displayed on a shelf on one side or the other of the aisle. The products arrive and their details (cost, quantity, SKU number, package size, purchase date) are recorded in the back room before they are displayed. The new owner wants to know which 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 how busy 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 every employee. All employees are paid weekly against an hourly rate which varies depending on their job description. Each sale is identified by a Receipt No. and a timestamp (date and time) and consists of sale
  • 33. items with a quantity and price recorded for each product. As a convenience for known customers, they offer a local delivery service. Deliveries are only made to customers who are registered at the store; walk-ins must record their name, address, and phone 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 a point 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 the delivery, how long the delivery takes, and the amount of the sale. There is concern at this point that 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 the information given to you by John and his staff. Through analysis of the nouns and verbs in the case study above, you have accumulated the following entity, attribute, and relationship information shown in the table below. The attribute list may not be complete. If you determine that additional attributes are needed to better define an entity then you should add them. Entities Attributes and Relationships for Clapham Store: Entity Attributes Relationships Employee ID Number, Last Name, First Name, Phone Number, Employee Type ID An Employee can belong to any one of the three job categories, but can belong to one and only one of the three. Employees have names and other contact information. Employee Type Type ID, Description, Hourly Pay Rate An employee can be either a clerk, delivery person, or a supervisor. Register Log Register Log Number, Register Number, Log In Time, Log Out Time, Employee ID Sales are made using a register and can be tracked by the register log number. An employee must log into the register before he/she can use it and must log out when finished with a shift at that register. An employee may use more than one register during a period of work. Register Register
  • 34. 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 the store; one on the left and one on the right of the entrance. Deliveries Delivery 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. An employee can make many deliveries but a sale is delivered by one and only one employee. Location Location ID, Aisle, Side, Shelf Relates to product and identifies one or more areas of the store where products are displayed. Product Product ID, Name, Package Size, Cost, Quantity on Hand (QOH), Last Purchased Date, Reorder Minimum Identifies the products the store sells. One or more products can be sold per sale. The quantity on hand allows John to determine his inventory levels. The reorder minimum can be used to determine when the inventory level has reached a reorder point. Sale Receipt Number, Sales Amount, Sale Date- Time A 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 one delivery person. Sold Items Receipt Number, Product ID, Item Price, Quantity Sold Sale Item is part of sale and records product sold per sale. Sale item must be able to associate multiple products sold on a single sales receipt. Customer Customer Number, First Name, Last Name, Address, Phone Number A customer can be associated with multiple sales, but any one sale is to one and only one customer. 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 Crow's Foot notation. You will need to determine the cardinality and optionality
  • 35. for each direction of the relationships. Some of the Foreign Key relationships are identified in the graph above but not all. Be sure you identify and account for all Foreign Key relationships. Add a name (in both directions) to the relationships. Remember, if you can verbalize the relationship in both directions then you probably have a valid relationship. Deliverables The deliverable for this lab will be your completed ERD as a single MS Word document using copy/paste from the MS Visio application and named "lab2_solutions_yourname". L A B S T E P S STEP 1: Drawing entities and attributes Be sure to include all of the entities that have been defined. You need to include at least the primary and foreign key attributes where applicable in your diagram. STEP 2: Indication of all relationships Be sure that you link all entities based on PK to FK relationships. There may be a case where you need to identify a combination PK and if so make sure that all of the relationships involved are defined. Be sure that you have set your Visio editor to show Crow's Foot notation. Also, be sure that you are defining the correct cardinality for the relationships. STEP 3: Naming of relationships Do not accept the default naming convention for your relationships in all cases. There may be some relationships where this is applicable, but in most cases you will want to explicitly name the relationship. Be sure that you have provided a verb phrase for both directions in the relationship. This is the end of lab #2 --------------------------------------------------------------- CIS 336 Week 3 Group Project Task 1 Data Model For more course tutorials visit www.tutorialrank.com
  • 36. Present a detailed data model for the project scenario. You can create your data model using Microsoft Visio, which you will have access to through iLab and Microsoft Excel, which comes with Microsoft Office. Other tools may be used as long as the output is legible and conforms to standard format. (i.e. I will not be able to grade the data model if I cannot tell what it is supposed to be!). Your data model should include a minimum of an ERD and metadata chart (data dictionary). A key component to every task submission is the team responsibilities document. This document should outline the contributions that each member of the team made to completing the task deliverable. There is a sample document in the Doc Sharing tab that can be used, or each team can come up with their own design. As stated in the syllabus, although this is a team project, each member will also be graded on their involvement in the project. This assessment needs to be honest and accurate in describing the individual members’ activities for the task. Deliverables for this task: A completed Data Model to include: An ERD, showing all tables, related attributes, and the primary and foreign keys. This diagram must show both the relationship and cardinality of the relationship using accepted notation. A Data Dictionary (or meta data chart) showing a minimum of the table name, columns, data types, length, and constraints. Team member responsibilities document outlining contributions by team members to this deliverable. --------------------------------------------------------------- CIS 336 Week 3 iLab 3 Devry University
  • 37. For more course tutorials visit www.tutorialrank.com Beginning with this lab, and continuing through the remaining weeks you will be doing all of your work in Oracle itself. The editor interface to the Oracle server is SQL*Plus, and by now you have received your logon ID and password and should have at least made sure you can connect. If for any reason you have not done so, please do so now before continuing any further. If for any reason you cannot connect then you need to let the instructor know ASAP so that any problems can be resolved. Before attempting Lab #3, you need to be sure you have read through the SQL*Plus tutorial which can be found in Doc Sharing as well as under the SQL*Plus Tutorial tab in Week 3. This tutorial describes the functionality of the editor and will take you through the process of setting up and using the SQL*Plus in the iLab environment so that it will best serve your needs for the remainder of the labs required for this course. The lab for this week addresses taking a logical database design (data model) and now transforming that into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the Zip file titled "Lab 3 Support Documents" from Doc Sharing. This Zip file contains three documents: Lab 3 Relationship Diagram.docx, Lab 3 Meta Data Diagram.xlsx, and Lab 3 Input Data.docx. Your job will be to take the meta data defined in the data dictionary spreadsheet document, and using the relationship diagram as a guide 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
  • 38. 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. Narrative/Case Study For this lab, you be working with command-line SQL to build a series of relational tables, using SQL CREATE statements in a script file format for the Student Database and 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: The drop table statements listed later in the specifications of this lab. The CREATE TABLE statements required to build the seven (7) tables. The INSERT statements necessary to insert all of the sample data. 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 three documents which can be found in the Doc Sharing tab on the course website: A Relationship Diagram of the database showing in graphical form the 1:M relationships between the tables (336_Lab3_Relationship_Diagram.doc). 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). 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
  • 39. constraint - CC Explicitly name all constraints PRIMARY KEY, FOREIGN KEY, and CHECK constraints to reflect: 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 constraints Create all PRIMARY KEY and NOT NULL constraints within the CREATE TABLE statements at the column level (line level), unless the Primary Key is a composite Primary Key (yes, there is one). Composite Primary Key constraints must be created at the table level. Create all FOREIGN KEY and CHECK constraints at the table level using ALTER TABLE statements. All constraints must be added prior to populating the tables with data. Create all of the tables and all of the constraints before populating any of the tables with data. Insert statements must be in the same order as the tables are created (follow the order in the sample data file). ALL character strings must be enclosed in single quotes. This includes alpha strings and alphanumeric (remember that any formatting within a numeric strings 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. Deliverables The deliverable for this lab will include the following documents. 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 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 both the SQL commands and results will show in the output. Be sure your name is on all documents and that all documents have been included in a single Zip file for this week’s assignments. L A B S T E P S STEP 1: The DROP statements The following DROP TABLE statements must appear at the
  • 40. top of your script file. This will allow you to run and re-run your script file as often as you need to. The first time you run your script file you will get an ERROR on the drop statements saying the Table or View does not exist. This is true since it has not been created yet, but the error is more informational than anything. Once the tables are created, you will not get this error again. DROP TABLE ENROLLMENT CASCADE CONSTRAINTS PURGE; DROP TABLE COURSE_SECTION CASCADE CONSTRAINTS PURGE; DROP TABLE COURSE CASCADE CONSTRAINTS PURGE; DROP TABLE TERM CASCADE CONSTRAINTS PURGE; DROP TABLE STUDENT CASCADE CONSTRAINTS PURGE; DROP TABLE FACULTY CASCADE CONSTRAINTS PURGE; DROP TABLE LOCATION CASCADE CONSTRAINTS PURGE; STEP 2: The CREATE TABLE statements Next, define the CREATE TABLE statements for the seven tables that you are to create based upon the ERD and Data Dictionary that you have been given for this lab. Be sure to follow the guidelines given above on how and where to create the different types of constraints for each table. STEP 3: The INSERT statements for the data The third step is to create the insert statements to insert the sample data into the tables created in Step 2. You might find it helpful to take the Word document containing the sample data and save it as a text file. After doing this, you could create the insert statements around the actual data that is in that file. The process for doing this should have been covered in one of the lectures for this unit. If it was not, then ask your instructor to discuss this process with the class. STEP 4: The SELECT statements The next step of the lab will be to create the select statements to verify the data was inserted correctly. You should have seven select statements; one for each table. The command is SELECT * FROM Table_Name; For example, to select all columns from the Student table, the command would be SELECT * FROM
  • 41. Student; Be sure to save all of the above statements in your script file. STEP 5: Testing and verifying your script Now we come to the point of verifying that your script file works by creating all of the tables and inserting all of the data. To verify this you will need to execute your saved script file and create an output file to capture the results being returned to the session by using the spool COMMAND outlined in the tutorial "Using Oracle SQL*Plus." This output file will be one of the files you will be turning in for grading. --------------------------------------------------------------- CIS 336 Week 4 Group Project Task 2 For more course tutorials visit www.tutorialrank.com Task 2 - Logical Model (30 points) Using the Oracle SQL*Plus editor, develop a database for MiniQuest based on your data model. The database should contain all the tables and attributes discussed in the project specifications. Be sure to use your data dictionary when creating your tables. A key component to every task submission is the team responsibilities document. This document should outline the contributions that each member of the team made to completing the task deliverable. To submit
  • 42. this task, you need to create a file in notepad called TEAM_X_TASK2.TXT, where X is your team identifier. For example, Team A would name the file TEAM_A_TASK2.TXT. In this file, create a heading called CREATE STATEMENTS, and then develop the CREATE TABLE statements required to create your database tables. Be sure to include the DROP TABLE statements at the top of your file so that you can reuse the file. If you include the wording CASCADE CONSTRAINTS as part of each DROP TABLE statement, then the order of the DROP statements will not mater. For example, to drop a table named customer, you would state: DROP TABLE CUSTOMER CASCADE CONSTRAINTS PURGE; After testing and verifying that all of your create statements work, create a spooled output file with the SET ECHO ON session command set so that your code and the results will show. Deliverables for this task: Revisions of Task 1 (if any) based on feedback from your instructor. Task 2 comprised of the CREATE TABLE script file and the output file showing that it works. Team member responsibilities document outlining contributions by team members to this deliverable. --------------------------------------------------------------- CIS 336 Week 4 iLab 4 Devry University For more course tutorials visit www.tutorialrank.com
  • 43. Lab 4 of 7: Building the Physical Model (28 points) Submit your assignment to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, please click here. (See Syllabus/"Due Dates for Assignments & Exams" for due dates.) L A B O V E R V I E W Scenario/Summary 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 set of tables found in the script file (LeeBooks.sql) found in the Doc Sharing area of the website. You will need to download the file, then run the script in your SQL*Plus session. These tables will be used for the remaining labs in this class. The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #4 will explore all of these applications of the SELECT statement. General Lab Information and Considerations Each query in the script file you will create must be numbered (use - -1 comments for numbering) and listed in order. The SQL for the following exercises should be written using Notepad and run in SQL*Plus. Read each problem carefully and follow the directions as stated. A Clean Script File: A script file is meant to be like a program. The file can be run every time the code needs to be executed without having to retype the code again each time. For this reason, it is important that there are no
  • 44. errors in the code inside the file. You can go back and forth between Notepad and Oracle when creating your script file to check your queries and verify if they work or not, but you do not want to create your final output file until after you have verified that everything in your script is correct by running it, in its entirety at least once and viewing the output. Once this has been done, you can create your final output file, with echo on to create the document you can turn in with your lab. Remember in using a spool session, you must type "SPOOL OFF" at the SQL> prompt after your script stops spooling to capture all of your data! Lab Do's and Don’t's Do Not include the LEEBOOKS.SQL as part of your lab script. Do use Notepad to write your query script file. Do Not write your queries in Word. Do test each query before moving on to the next. Do Not include extra queries for a problem unless the problem explicitly asks for more than one query. Do test your queries before creating your final output file. Do Not turn in a script file that has queries with errors. Do number each query using - -1 comment notation. Do Not start your query on the same line as the comment. Do remember to check your final output and script file for accuracy. Do Not turn in your lab without first checking your output file to verify that it is correct. Things to keep in mind: If you are not sure of the table names in your user schema, you can use the following select statement to list them. SELECT * FROM TAB; If you want to know the name of the columns in a particular table, you can use the following command to list them. DESC Making a script file containing a series of describe statements for each table and then spooling the output will give you a listing of all the tables with column names. Be sure to review and verify your final output when you are finished. DO NOT assume anything. Write queries for each of the stated problems in the steps below that will return a result set of data to satisfy the requirements. When finished, your script file should have a total of 13 queries and your resulting output file should show both the query and
  • 45. result set for each. Deliverables The deliverable for this lab will include: Your script file with the 13 queries in it. Be sure your name, course number, and lab number are in a comment area at the top of your file. An output file created using SET ECHO ON showing both the SQL code and the results. Both documents are to be zipped into a single file before submitting to the iLabDropbox for Week 4. L A B S T E P S STEP 1: Using the BOOKS table, write a query that will list the categories for the books in inventory. List each category only once in your result set. STEP 2: Using the BOOKS table, write a query that will list the title and publisher ID for each book in the table. Use the column heading of "Publisher ID" for the pubid field. STEP 3: Using the BOOKS table, write a query that will list the book title, retail price, and the amount of markup for each book. The amount of markup is the retail price minus the cost. Use the column heading “Price Markup” for the arithmetic expression column. STEP 4: Using the BOOK_CUSTOMER table, write a query that will list the customer’s first name, last name, and city for those customers living in zip code 31206. STEP 5: Using the BOOK_ORDER table, write a query that will list everything about the orders placed prior to April 2, 2009. STEP 6: Using the BOOK_ORDER table, write a query that will list everything about the orders that have not been shipped yet. STEP 7: Using the BOOK_CUSTOMER table, write a query using the AND and OR operators that will list the customer information for those customers living in either Florida or New Jersey who have not been referred by another customer. STEP 8: Using the BOOKS table, write a query that will list all information about those books that are not computer books and do not cost more than $30.00 retail. STEP 9: Using the AUTHOR table, write a query that will list all information about authors whose first name ends with an “A”. Put the results in descending order of last name, and then ascending order by first name. This should be done using a single query. STEP 10: Using
  • 46. the BOOK_ORDER table, write a query using the > and < operators="" that="" will="" list="" the="" orders="" that="" were="" placed="" between="" april="" 1,="" 2009="" and="" april="" 4,="" 2009.="" only="" show="" the="" orders="" for="" april="" 2nd="" and="" 3rd="" in="" your="" result="" set.="" step="" 11:="" using="" the="" book_order="" table,="" write="" a="" query="" that="" will="" list="" the="" orders="" that="" were="" placed="" between="" april="" 2,="" 2009="" and="" april="" 4,="" 2009="" including="" those="" placed="" on="" the="" 2nd="" and="" 4th.="" use="" a="" different="" approach="" (operator)="" in="" writing="" this="" query="" than="" used="" in="" the="" query="" for="" #10,="" that="" is,="" do="" not="" use=""> and < signs="" in="" your="" query.="" step="" 12:="" using="" the="" books="" table,="" write="" a="" query="" that="" will="" list="" the="" book="" title,="" publisher="" id,="" and="" published="" date="" for="" all="" books="" that="" were="" published="" by="" publisher="" 4="" or="" after="" january="" 1,="" 2001.="" order="" the="" results="" in="" ascending="" order="" by="" publisher="" id="" and="" give="" the="" publish="" date="" and="" publisher="" id="" columns="" meaningful="" titles.="" step="" 13:="" many="" organizations="" use="" percentage="" of="" markup="" (e.g.,="" profit="" margin)="" when="" analyzing="" financial="" data.="" to="" determine="" the="" percentage="" of="" markup="" for="" a="" particular="" item,="" simply="" subtract="" the="" cost="" for="" the="" item="" from="" the="" retail="" price="" to="" obtain="" the="" dollar="" amount="" of="" profit,="" and="" then="" divide="" the="" profit="" by="" the="" cost="" of="" the="" item.="" the="" resulting="" solution="" is="" then="" multiplied="" by="" 100="" to="" determine="" the="" percent="" of="" markup.="" using="" a="" select="" statement,="" display="" the="" title="" of="" each="" book="" and="" its="" percent="" of="" markup.="" for="" the=""
  • 47. column="" displaying="" the="" percent="" of="" markup,="" use="" “markup="" %”="" as="" the="" column="" heading.="" this="" is="" the="" end="" of="" lab="" #4=""> --------------------------------------------------------------- CIS 336 Week 5 Group Project Task 3 For more course tutorials visit www.tutorialrank.com Task 3 - Verification of Logical Model(45 points) Develop the SQL statements to insert records into the database. You should ensure that the data in the database is sufficient to allow for each of the reports requested by Ms. Smith to be tested. You need to show a minimum of three insert queries for each database table that you have created. Some tables will obviously require more to ensure that all of the required data is in the database (i.e., the packages table, program table, etc). To submit this task, add a comment heading called INSERT STATEMENTS to your corrected SQL script from Task 2. Add your INSERT statements for each table after this heading. Keep in mind that you will need to insert data into the tables in the same order that the tables were created. This will minimize any integrity constraint errors you might encounter. Keep in mind also that any values being inserted into a field defined as a foreign key field must first exist in a previous
  • 48. table’s primary key field. Save the file as TEAM_X_TASK3.TXT, where X is your team identifier. After testing your statements to verify that your data will insert into your tables, create a spooled output file with the SET ECHO ON session command set for submitting. Note – Although you are only required to have three records per table in most of your tables for this deliverable, you will need a considerable amount of data in your tables for the final project. After testing and verifying that all of your create statements work, create a spooled output file with the SET ECHO ON session command set so that your code and the results will show. Deliverables for this task: Any revisions of task 2 based on feedback from your instructor. Task 3 comprised of the script file containing DROP TABLE, CREATE TABLE, and INSERT statements, and the output file showing that it works. Team member responsibilities document outlining contributions by team members to this deliverable. --------------------------------------------------------------- CIS 336 Week 5 iLab 5 DevryUniversity For more course tutorials visit www.tutorialrank.com
  • 49. Lab 5 of 7: Retreiving data from Multiple Tables (28 points) Submit your assignment to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, please click here. (See Syllabus/"Due Dates for Assignments & Exams" for due dates.) L A B O V E R V I E W Scenario/Summary 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 write a query using either the TRADITIONAL method of joining tables or using the JOIN key word. In some cases, you will be asked to use a specific approach. Using the incorrect process when the process is specified will result in points being taken off for that problem. The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #5 will explore all of these applications of the SELECT statement. General Lab Information and Considerations This lab will utilize a set of tables found in the script file (LeeBooks.sql) found in the Doc Sharing area of the website. If you have not yet downloaded this file from Doc Sharing then do so now. Once you have downloaded the script file, import and run the script in SQL*Plus. Each query in the script file you will create must be numbered (use --1 comments for numbering) and in order. The SQL for the following exercises should be written using notepad and run in SQL*Plus. A Clean Script File: A script file is meant to be like a program. The file can be run every time the code needs to be executed without having to retype the code again each time. For this reason, it is
  • 50. important that there are no errors in the code inside the file. You can go back and forth between Notepad and Oracle when creating your script file to check your queries and verify if they work or not, but you do not want to create your final output file until after you have verified that everything in your script is correct by running it, in its entirety at least once and viewing the output. Once this has been done, you can create your final output file, with echo on to create the document you can turn in with your lab. If using a Spool Session, be sure to type "SPOOL OFF" AT THE SQL> after your Script Stops Spooling! Lab Do's and Don’t's Do Not include the LEEBOOKS.SQL as part of your lab script. Do use Notepad to write your query script file. Do Not write your queries in Word. Do test each query before moving on to the next. Do Not include extra queries for a problem unless the problem explicitly asks for more than one query. Do test your queries before creating your final output file. Do Not turn in a script file that has queries with errors. Do number each query using --1 comment notation. Do Not start your query on the same line as the comment. Do remember to check your final output and script file for accuracy. Do Not turn in your lab without first checking your output file to verify that it is correct. Things to keep in mind: If you are not sure of the table names in your user schema, you can use the following select statement to list them. SELECT * FROM TAB; If you want to know the name of the columns in a particular table, you can use the following command to list them. DESC Making a script file containing a series of describe statements for each table and then spooling the output will give you a listing of all the tables with column names. Be sure to review and verify your final output when you are finished. Do Not assume anything. Write queries for each of the stated problems in the steps below that will return a result set of data to satisfy the requirements. When finished, your script file should have a total of 13 queries and your resulting output file should show both the query and
  • 51. result set for each. Deliverables Submit for grading: Your script file with the 13 queries in it. Be sure your name, course number, and lab number are in a comment area at the top of your file. Submitting ONLY your spooled output will result in a 10-point deduction. An output file created using SET ECHO ON showing both the SQL code and the results. Both documents must be zipped into a single file before submitting to the iLabDropbox for Week 5. L A B S T E P S STEP 1: Using the BOOKS and PUBLISHER tables, create a query using the traditional join method that will return a list containing the book title, publisher contact person, and publisher phone number for all publishers whose publisher name starts with an ‘R’. STEP 2: Using the DUAL table, create a query that will return the day of the week, hour, minutes, and seconds of the current date setting on a computer. The day should be in all upper case. STEP 3: Using the BOOK_CUSTOMER and BOOK_ORDER tables, create a query using the NATURAL JOIN method that will return a list containing the customer first name and last name and the order number for all orders that have been shipped. Give the customer name column an alias of "Customer Name" and order the output by the customer number in the BOOK_ORDER table in ascending order. STEP 4: Using the BOOK_ORDER table, create a query that will return the order number, order date, shipping address, city, state, and zip code for all orders going to Atlanta or Austin. Format the order date to display as Month DD, YYYY and give the column an alias of "Date Ordered". Be sure the month begins with a capital letter. STEP 5: Using the BOOK_ORDER table, create a query using the correct function to return the order number, the date ordered, the date shipped, and a column representing the number of months between the two dates for all columns where a date shipped exists. Format the number returned from the function to display only two decimals, and give the column an alias of "Months Between". NOTE: Be sure that all of the numbers in the fourth column
  • 52. are positive numbers. STEP 6: Using the correct tables in your schema, create a query using either join operation that will list the title of each book and author name(s). Give the title column an alias of "Book Title". Sort the results by title and then by author last name. STEP 7: Using the BOOKS table, create a query that will return the book title, cost, and retail price for all books with a title starting with the letter ‘H’. Use the correct conversion function to format the cost and retail columns to show dollars and cents with a dollar sign (e.g., a price of $25 would display $25.00 in the result set). STEP 8: Using the BOOK_ORDER, ORDER_ITEMS, and BOOKS tables, create a query using an OUTER JOIN operation that will list the book title, order date, and order number for all books in the BOOKS table. Order your output in descending order by ORDER_ITEMS.BOOKID. There are three books that have never been ordered which should show up at the top of your listing. STEP 9: Using the correct tables, create a query using the traditional join operation that will list the customer first and last name, book title, and order date (formatted as MM/DD/YYYY with an alias of “Order Date”) for all the customers who have purchased books published by 'PRINTING IS US'. STEP 10: Using the BOOKS and ORDER_ITEMS table, write a query using the correct Relational Set Operator that will show all of the Book IDs in the BOOKS table that have not been ordered. STEP 11: Using the BOOK_CUSTOMER, BOOK_ORDER, ORDER_ITEMS, and BOOKS tables, create a query using traditional join conditions based on comparisons between primary and foreign keys that will list the customer number, first and last name, and book title. Limit your listing to only those books in the ‘FITNESS’ category. STEP 12: Using the BOOKS, ORDER_ITEMS, and BOOK_ORDER tables, create a query that will list the title, retail, quantity, and order date for all books ordered after April 30, 2009. STEP 13: Using the correct tables, create a query using either join operation you wish that will list the order
  • 53. id, order date, quantity ordered, and retail price for every book that has been ordered. Format the date as MM/DD/YYYY with an alias of “Order Date” and format the retail price column using the correct function to show dollars and cents with a dollar sign ( $ ) and a column alias of “Retail”. This is the end of lab #5 --------------------------------------------------------------- CIS 336 Week 6 Group Project Task 4 For more course tutorials visit www.tutorialrank.com Task 4 - Verification of Transaction Processing (30 points) Develop a query that will identify and mark inactive those customers that have bills overdue by more than 30 days (this can usually be done using a sub-query). Remember, you are only marking a customer as inactive, not actually deleting the customer record from the system. To submit this task, create a heading called MODIFY STATEMENTS in your group project SQL script, and name the file TEAM_X_TASK4.TXT. This should be the same script that contains your DROP TABLE, CREATE TABLE, and INSERT statements. Once you have verified that your SQL statement or statements work, create a spooled output showing the results of your statements. Deliverables for this task:
  • 54. Any revisions of task 3 based on feedback from your instructor. Task 4 comprised of the complete script file (DROP, CREATE, INSERT, SELECT, and UPDATE statements) and the output file showing that it works. Team member responsibilities document outlining contributions by team member to this deliverable. --------------------------------------------------------------- CIS 336 Week 6 iLab 6 Devry University For more course tutorials visit www.tutorialrank.com Week 6. L A B S T E P S STEP 1: Back to top Using the BOOK_CUSTOMER table and the NVL function, create a query that will return a list containing the customer number, first name, last name, and the characters ‘NOT REFERRED’ if the customer was not referred by another customer. Give the derived column an alias of REFERRED BY. Do not list any customers that were referred by another customer. STEP 2: Back to top Using the BOOKS table and the SUBSTR function, create a query that will return a list of book ISBN codes and the book title for all the computer books. Format the ISBN code to display as 9- 999-99999-9 (e.g., 1059831198 would display as 1-059-83119-8) STEP 3: Back to top Using the BOOKS table, create a query using the correct functions to return the category name, the total retail of all books per category with a column alias of "Total Retail", and the average retail of all the books per category with an alias of "Average Retail" for all categories with a total retail greater than $40.00. Format the total retail
  • 55. and average retail columns using the correct function to show dollars and cents with a dollar sign. STEP 4: Back to top Using the correct tables in your schema, create a query using either join operation you wish that will list the book title and number of authors for all books that have been written by more than one author. Give the title column an alias of "Book Title" and the column showing the number of authors an alias of "Number of Authors". STEP 5: Back to top Using the BOOK_AUTHOR and AUTHOR tables for the upper most query, create a sub query that will return the BOOKID, and the first and last name of the author(s) who have written the book(s) that have been purchased the most. To successfully accomplish this, you will need to first find out the maximum total number of copies (based on quantity) sold of a book (based on bookid) in the ORDER_ITEMS table. This will be done in the bottom most query. The return from this query will be used to compare against the BOOKID in the ORDER_ITEMS table that occurs an equal number of times in the middle query. The return of this query will then be used to compare to a BOOKID related to an Author in the tables of the top most query. (HINT: Be careful, you will need both GROUP BY and HAVING clauses for your solution.) STEP 6: Back to top Using the correct tables, create a sub query using either join operation you wish that will list the customer number, first and last name concatenated together, and city for all customers who have placed an order for the most expensive book (based on retail price). Give the combined customer names column and alias of "Customer Name". STEP 7: Back to top Using the ORDER_ITEMS table, create a query using the correct functions to return the item#, the total quantity of items ordered with an alias of "Total", the average quantity per order with an alias of "Average" (since averages are often in decimals, only show two decimal places), the minimum quantity ordered with an alias of "Minimum", and the maximum quantity ordered with an alias of "Maximum". Your
  • 56. output results set should have five columns and four rows of data. STEP 8: Back to top Using the BOOKS table, create a query using the DECODE function that will display the book title, the published date, and the publisher name (this is where the decode function comes in). Give the publisher name column an alias of "Publisher Name", and order the publisher names in descending order. The publisher names used should be the same as those in the PUBLISHER table. DO NOT join to the Publisher table for this query. STEP 9: Back to top Using the PUBLISHER table, create a query that will return a line of output like the one below for each record in the table. Be sure to use the correct functions in the SELECT statement, so that your output looks like the example below. The contact person for Printing Is Us Publishing is Tommie Seymour. Be sure to use the correct function to display the publisher name and publisher contact with only the first letter of each word capitalized. STEP 10: Back to top Using the correct tables, create a query using the JOIN ON method to display a listing of all customers who have purchased more than two books. List the customer’s last name, the customer’s city and state, and the number of books they have purchased. Give the number purchased column and alias of "Number Purchased". STEP 11: Back to top Using only the BOOK table for the upper most statement, create a sub query that will update the retail price of all books published by PRINTING IS US by five percent (retail * 1.05). Remember, all you have is the publisher "name". Use the sub query to find the publisher ID. To verify your update, provide a select statement on the BOOKS table before your update statement, and then a second select on the BOOKS table after the update. Once you have verified the results, you can issue a ROLLBACK statement to return the data to the original state. STEP 12: Back to top Using the BOOK_CUSTOMER table, write a sub query that will return the names of those customers who were referred by the same individual who
  • 57. referred Jorge Perez. Do not display Jorge Perez’s name in the returned results (Hint: you should only have two customers displayed and the exclusion for Jorge Perez must be associated with the upper query). STEP 13: Back to top Using the BOOKS table, create a query using the correct functions to return the category name, total number books per category with a column alias of "Category Total", and the total cost of all the books per category with an alias of "Cost". Format the cost column using the correct function to show dollars and cents with a dollar sign. This is the end of Lab #6 Back to top]HTML --------------------------------------------------------------- CIS 336 Week 7 Group Project Task 5 For more course tutorials visit www.tutorialrank.com Develop the queries to support each of the reports that are required by Ms. Smith. It is expected that the information returned by the queries is adequate to be used in the reporting process. Make sure your output contains enough information! The following is a recommendation and the MINIMUM amount of data you should have access to: Customer Table: A minimum of 12 customers (this will allow several channels to have more than one customer selecting it as a favorite channel) Billing Table: Records to support the above customers Program Table: A minimum of 25 programs (your program guide should have
  • 58. enough programs for various channels to support the program guide report) Other tables: A sufficient amount of data to support the above when reports are run Create a heading of REPORTING STATEMENTS as a comment at the bottom of your group project database script file. Add the six report queries to this area. In instances where you are asked to allow for user input, please specify an appropriate value based upon the data in your script. For example, Report 1 is a DATE driven report; therefore, you should use a single date in your WHERE clause to display the information. Task 5 is the final task for the project and is designed to demonstrate that you have adequately satisfied the requirements of the project. The following is what you are to submit for Task 5: Report 1 – A list of the programs on all channels for a specific day showing the channel number, supplier, package, program name, rating code, and show time. This will be similar to a program guide, only not package specific. This is a date-driven report, therefore it should only display programs for a single date specified. Report 2 – A sample program guide showing the channel number, show time, program name, and rating description. For the purposes of this project, your report should be package ID specific (based on a given package ID) and you only need to demonstrate a single package ID. Your report should include all channels associated with the specified package. Report 3 – A list of all new customers signed up on a specific day. This should show enough details about the customer, including favorite channel, address, and minimal billing details. This report is to be date driven, so you will need to specify a date in your query. Report 4 – A list of all the customers made inactive on a specific date. This should show enough details about the customer to allow contact with the customer, the reason he or she was made inactive, and the user who made them inactive.
  • 59. Again, keep in mind that this is a date driven report. Report 5 – A list of each channel (both channel name and channel number) and a count of the number of customers who picked that channel as a favorite channel. Report 6 – A summary of sales for any given day, categorized by package type (i.e., the total sales written on the specified day for each package subscribed to by customers, not bills paid). This report should give details about each package type, the package price, the number of packages sold, and then the total sales amount for that package. Once again, remember that this is going to be a date driven report. --------------------------------------------------------------- CIS 336 Week 7 iLab 7 Devry University For more course tutorials visit www.tutorialrank.com L A B O V E R V I E W Scenario/Summary 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. Being able to enhance the efficiency of the database tables by using additional indexes is also a very important aspect of database development. Finally, being able to create and use Database Sequences to automate some of the sequential processes in the database can not only save time but improve efficiency. In Lab 7, you will have a chance to work with all three of these areas. General Lab Information and Considerations This lab will utilize
  • 60. the same set of tables found in the script file (LeeBooks.SQL) that were used for Labs 4 through 6. Each query in the script file you will create, must be numbered (use either –1 or REM 1 comments for numbering) and in order. The SQL for the following exercises should be written using notepad and run in SQL*Plus. Read each problem carefully and follow the directions as stated. A Clean Script File: A script file is meant to be like a program. The file can be run every time the code needs to be executed without having to retype the code again each time. For this reason, it is important that there are no errors in the code inside the file. You can go back and forth between notepad and Oracle when creating your script file to check your queries and verify if they work or not. However, you do not want to create your final output file until after you have verified that everything in your script is correct by running it in its entirety at least once and viewing the output. Once this has been done, you can create your final output file, with echo on to create the document, you can turn in with your lab. Remember in using a Spool Session, you must type "SPOOL OFF" at the SQL> PROMPT after your Script stops spooling to capture all of your data! Lab Do's and Don't's Do Not include the LEEBOOKS.SQL as part of your lab script. Do use Notepad to write your query script file. Do Not write your queries in Word. Do test each query before moving on to the next. Do Not include extra queries for a problem unless the problem explicitly asks for more than one query. Do test your queries before creating your final output file. Do Not turn in a scrip file that has queries with errors. Do number each query using either --1 or REM 1 comment notation. Do Not start your query on the same line as the comment. Do remember to check your final output and script file for accuracy. Do Not turn in your lab without first checking your output file to verify that it is correct. Things to keep in mind: If you are not sure of the table names in your user schema, you can use the following select statement to list them. SELECT * FROM TAB; If you want to know the name of the columns in a particular table, you can use the following command to list them. DESC Making a script file containing a series of describe
  • 61. statements for each table and then spooling the output will give you a listing of all the tables with column names. Be sure to review and verify your final output when you are finished. Do Not assume anything. Write queries for each of the stated problems in the steps below that will return a result set of data to satisfy the requirements. When finished, your resulting output file should show both the query statement and result set for each query. Deliverables The deliverable for this lab will include: Your script file with the seven queries and oneexplanation in it. Be sure your name, course number, and lab number are in a comment area at the top of your file. An output file created using SET ECHO ON showing both the SQL code and the results. Be sure that you include your answer to question #3 as a comment in this file. Both documents are to be zipped into a single file before submitting to the iLabDropbox for Week 7. L A B S T E P S STEP 1: Create a simple view named CUST_VIEW using the book_customer table that will display the customer number, first and last name, and the state for every customer currently in the database. Now insert the following data into the book_customer TABLE using an INSERT statement. (Do not use the View for this insert.) CUSTOMERID - 1021, FIRSTNAME – EDWARD, LASTNAME – BLAKE, STATE – TX. Now query your view and display the new record. STEP 2: Create a complex view named CUST_ORDER that will list the customer number, last name, and state from the BOOK_CUSTOMER table, in addition to the order number and order date from the BOOK_ORDER table. Insert the following data into this view (use the view for the insert statement): CUSTOMERID - 1022, LASTNAME – smith, STATE – KS, ORDERID - 1021, and ORDERDATE – 10-OCT-2004. STEP 3: In your own words, explain why the insert statement for the view you created in Step 2 did not work. STEP 4: Create a sequence that can be used to assign a publisher ID number to a new publisher. Define the sequence to start with seven, increment by two, and stop at 1000. Name the sequence PUBNUM_SEQ. STEP 5: Insert two new publishers into the PUBLISHER table, one named Double Week with a contact
  • 62. name of Jennifer Close at 800-959-6321, and the second one named Specific House with a contact name of Freddie Farmore at 866-825- 3200. Use your new sequence to create the PUBID for each record. Now, query your PUBLISHER table to see your two new records. STEP 6: Using a single query, query the PUBNUM_SEQ to determine what both the current sequence number is and the next sequence number will be. STEP 7: Create a unique index on the combined columns ORDERID and CUSTOMERID in the BOOK_ORDER table. Give the index a name of BOOK_ORDER_IDX. STEP 8: Determine how many objects you currently own in your schema by querying the USER_OBJECTS view in the Data Dictionary. Your result set should list the different object types that you find and include a count by object type. ---------------------------------------------------------------