Sie sind auf Seite 1von 4

Database Part 2

Due: Sunday, Dec. 4, 2016

Overview
In part 2 you will implement the database designed for part 1 of the database project in Oracle. Implement just the
database portion of the project not the user interface or application code. In this assignment you will create and
populate database tables and formulate the queries to extract data from these tables to support the data requirements
of the system.

Task 1 Table creation () DDL file from the SQL Data Modeler
1. IMPORTANT: Prior to executing the Oracle script to create the tables, make any required changes to your
design based on the comments provided for part 1 of the project.
a. Verify that you have not used any special characters or Oracle reserved words for your identifiers (i.e.:
Check, Order, Group, Online, Date, etc.).
b. Verify that you removed or replaced ALL special characters (including spaces) in your table and
attribute names. This includes ALL special characters other than the underscore.
2. If changes were made to your data model based on comments provided for Part 2 of the project, follow
the specific instructions provided in the SQL Data Modeler Tutorial #1 to specify the required Data
Modeler Preferences and in the SQL Data Modeler Tutorial #2 to create the DDL file from within the
SQL Data Modeler software. SETTING THE CORRECT PREFERENCES AND OPTIONS WHEN
CREATING THE DDL FILE IS VERY IMPORTANT.
3. Open the Oracle SQL Developer software and connect to the UNO Oracle server. Load and execute the DDL
file created for Part 1 of the project or in Step 2 above to create tables. Note that the first time you execute
this file, you will see an error message for every Drop Table statement in the file as the tables will not
yet exist. When you re-run this script file in the future, you will not see these errors. The CREATE TABLE
statements should execute without any errors, however. Note: DROP TABLE STATEMENTS ARE
REQUIRED AS PART OF YOUR DDL FILE
Task 2 Table population () Hints:

When creating your insert SQL statements, be sure to insert data into all parent tables before
inserting into child tables. Foreign key constraints will fail if corresponding records do not exist in
the parent table.
When inserting data into child tables, ensure any validation and foreign key constraints will be
met.
Use the sample data-insertion script files provided as examples on the course Blackboard page
under the Course Materials by Week as examples when writing your own data-insertion script file.

1. Write and save to a text file at least four (4) data insertion statements for each table in your design. You
will need to ensure that your foreign key values match the values of the primary keys in the linked tables.
Load and execute this script file on the Oracle server using the SQL Developer software. Some tables will
require more than 4 rows of data to support 4 rows in other tables.
a. Insert data into the parent tables before inserting data into the child tables. Referential integrity
will cause insert statements to fail if foreign key values do not match the primary key values in the
related table.

b. Some tables may need more rows to properly illustrate the databases functionality and as required
for the specific data requirements for Task 2 - Number 2 below.
Your insert statements for each table MUST be saved to a single, separate script file (text file). This
script file MUST load and execute without errors on the UNO Oracle server. See the sample database
(employees and flights) files posted to the Course Materials by Week page under the SQL folder for
examples of script files containing valid SQL Insert statements.
2. Add additional insert statements to your script file created for Task 2 Step 1 to support the specific data
requirements shown below. These insert statements are in addition to your minimum 4 rows per table for
Task 2 step 1 above.
a. Insert data for a client named Melinda Blackwell (you may create data values of your own for the
attributes for this client). Melinda should be a Buyer.
b. Insert data for a client named Keegan Styles (you may create data values of your own for the
attributes for this employee remember to add the appropriate client information for this client).
Keegan should be a Seller.
c. Add an item up for bid by Keegan Styles. Include all the required information for the item.
d. Add a Buy-It-Now item for sale by Keegan Styles. Include all the required information for the
item.
e. Create 3 (three) Bid records each for Melinda Blackwell AND for one of your other Buyer
clients. Melinda Blackwell should be recorded as the Buyer who won (or purchased) the item. Be
sure to enter sequential dates and times for the bids and allow Lindas final bid to be the one that
wins the item.
f.

Create a purchase record for Melinda Blackwell for the Buy-It-Now item you created for step 2d
above.

g. Create 2 feedback records for the purchase of the Buy-It-Now item purchased by Melinda
Blackwell and sold by Keegan Styles from step 2f above. You may enter values of your choice,
but you must have one feedback record left by the seller (Keegan Styles) reviewing the buyer
(Melinda Blackwell) and one record left by the buyer (Melinda Blackwell) reviewing the seller
(Keegan Styles).
h. Insert two (2) items on Melinda Blackwells Buyer Wish list.

TASK 3 Normalization Evaluation ()

After writing the insertion statements for each of your tables for Task 2 above, create a table in a
Word Document file (or other word processor file) and list all your table names. Identify the
normalizations levels of all tables in your design .
For each table, also identify the primary key for each table
a. Reminder: If partial dependencies exist, the table is not in 2NF; If transitive dependencies
exist, the table is not in 3NF
TABLE NAME
PRIMARY KEY
NORMALIZATION LEVEL
If not in 3NF, list the
transitive dependency

MyTable
My_ID
2NF
ZipCode -> State
YOU DO NOT NEED TO NORMALIZE YOUR TABLES FOR THIS PROJECT

Task 4 Queries ()
Write SQL statements to meet the following requirements for your Oracle database. These queries should be
stored IN ORDER, 1-10, in a separate SQL (text) script file to be submitted for this assignment . Use notepad
or a simple text editor to save all your queries to a text file.

Add a comment before each query identifying it by number: For example, on the line before query
1, add the text: -- Query 1 Save this file as a plain text file and ensure you have comments that the top with your
name. Reminder: Comments start with a double dash (--) in Oracle script files.
1. Write an SQL SELECT statement to select all of your Seller clients. Include the clients first name, last name,
screen name, street address, city, state and zip code in your query. Clients that are both Buyers and Sellers may
be included in this query, but clients that are only Buyers should not be included.
2. Write an SQL SELECT statement to display the information shown on the screen shot on page 3 of Part 1 of the
Project for the Items for Purchase, Buy-It-Now item, Summary View 1 for sale by Keegan Styles you
created for step 2d above. Include all the fields shown on the screen shot except for images, buttons and
payment types accepted. Note that you must include the screen name of the seller not the sellers ID number.
This will require a join of tables in your database.
3. Write an SQL SELECT statement to display the information shown on the screen shot on page 4 of Part 1 of the
Project for the Items for Purchase, Bid Option item, Detail View 2 for sale by Keegan Styles you created
for step 2c above. Include all the fields shown on the screen shot except for images, buttons and payment types
accepted. Note that you must include the screen name of the seller not the sellers ID number. This will require
a join of tables in your database.
4. Write an SQL UPDATE statement to change one of your Seller clients to a Buyer/Seller type client.
5. Write an SQL SELECT statement to list all the items on Melinda Blackwells item wish list. Include the title or
short description of the item, the current price of the item, the start and end dates for the item and the name of
the seller. Note that this will require a join of the tables containing the name of the seller, the item for sale and
the watch list information. You may use Melinda Blackwells client number in the query.
6. Write an SQL SELECT statement to select both of the feedback records created for step 2g above. Select the
screen names of the buyer and seller, the type of feedback (left by seller or by buyer), the feedback comments
and the positive/negative value of the rating along with the title or short description of the item purchased. This
will require a join of the feedback table, the client table(s) and the item table. You may use the item number in
your query.
7. Write an SQL SELECT statement to determine the number of bids placed on the item with the bids entered for
step 2e above. If you created the required 6 bids, this query should return 6.
8. Write an SQL SELECT statement to retrieve all the items for sale as Buy It Now items by one of your sellers
other than Keegan Styles. Use the name of the buyer in the query and select the item title or short description,
the current price of the item, the start and end dates of the auction, the number currently sold and the number
currently available for each item. This query will require a join of the Client/Seller table and the table
containing your Buy It Now items.

9. One of your sellers other than Keegan Styles has decided to remove an item listed for sale as a Buy It Now
item. When choosing your item, choose an item that has not been purchased. Write SQL delete statement(s) to
remove this item from your database. Note: This may require delete statements for more
than one table.
10. Write an SQL select statement to select the total paid to one of your sellers on all of their
Item for Bid items won (or purchased). Select a seller that has sold at least one item up
for bid.

Assignment Submission:
Please submit your files to the me. Submit a .zip file containing:
1. The 3 SQL script files (text files) containing all of your table creation statements for task 1, the data
insertion statements for task 2 and your SQL queries for task 4 above. Your name, date and class number
should be included at the top of each file.

Comment lines should begin with a double dash (--) in the SQL script file
a. Note that your table creation script file (the ddl file created by the Data Modeler software)
may need to be updated from part 1 of the project. Be sure to submit the most recent
verions.
2. The document file containing the normalization information from Task 3.

Das könnte Ihnen auch gefallen