​CMIS 320 Project 3

User Generated

zvzvunun

Writing

Description

CMIS 320 Project 3

In this assignment you will perform the physical design and implementation using SQL Data Definition Language (DDL) and proceed with populating the Mom and Pop Johnson Video Store database via Data Manipulation Language (DML) SQL commands.

For each of the steps below you may create a separate SQL script file and SPOOL file or you may want to put the SPOOL output for several steps, from the same SQL script file, in the same file. Be sure your SPOOL file(s) contains your SQL statements along with the Oracle responses and/or displayed
results. Do NOT submit your SQL script files. Only submit your output SPOOL files.

Assignment Details:

  1. 1) Create Oracle database tables using SQL Data Definition Language (DDL) for each table listed in the metadata of Project 2. You may need to use a combination of DROP TABLE, CREATE TABLE, and ALTER TABLE SQL statements. Make sure that entity and referential integrity are enforced by declaring a primary key for each table (these may be composite keys) and declaring all appropriate foreign keys. Your CREATE TABLE and ALTER TABLE statements (if desired) must show integrity constraints, as appropriate, for NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, REFERENCES, and CHECK constraints. Be sure to save your SQL script file used to create these tables with a .sql extension and your output SPOOL file with a .lst or .txt extension. You should rerun and test your SQL script file until it runs without any errors (this is why you’ll want to include DROP TABLE statements). Submit your SPOOL file showing that all SQL in your SQL script file worked properly.
  2. 2) Populate each of your tables with at least five valid rows of data each and show the SQL INSERT statements as you executed them. Populate other tables in your database, as necessary, to satisfy referential integrity. Save your SQL script file and SPOOL file with the correct extensions. You should test and rerun your SQL script file until it runs without any errors. Submit your SPOOL file showing that all SQL in your SQL script file worked properly.
  3. 3) Develop an SQL script file to perform the following queries and updates. You should test your SQL script file until it runs without any errors.

o Retrieve all of your customers' names, account numbers, and addresses (street and zip code only), sorted by account number.

o Retrieve all of the videos rented in the last 30 days and sort in chronological rental date order.

o Produce a list of your distributors and all their information sorted in order by company name.

o Update a customer name to change their maiden name to a married name. You can choose which row to update. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo your data update.

o Delete a customer from the database. You can choose which row to delete. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo your data deletion.

Submit your SPOOL file(s) showing that all SQL in your SQL script file worked properly. Show the actual SQL statements executed and the results the SQL produced below the code by making sure that you have a SET ECHO STATEMENT in your SQL script file(s).

Do NOT submit your .sql SQL script files.

Grading rubric

Attribute

Meets

Does Not Meet Expectations

CREATE TABLE and ALTER TABLE SQL statements

30 points

All SQL statements are syntactically correct and execute without errors; all integrity constraints are properly declared;

0 points

Many SQL statements fail due to syntax errors or SQL is missing

INSERT SQL statements

page2image7910704

25 points

All SQL statements are syntactically correct and execute without errors.

0 points

Many SQL statements fail due to syntax errors and/or integrity constraint violations or SQL is missing

SELECT SQL statements

20 points

All SQL statements are syntactically correct and execute without errors.

0 points

Many SQL statements fail due to syntax errors or SQL is missing

UPDATE and DELETE SQL statements

page2image7905504

10 points

Statements execute without errors based on primary key column in WHERE clause

page2image7906128

0 points

Statements fail due to syntax or other errors

SQL script file and SPOOL file

15 points

Demonstrates full ability to create and use an Oracle SQL script file and output SPOOL file

0 points

Many errors setting up and using an SQL script file with SPOOL file or no attempt made at all

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hello I have also attached SQL statements. You can edit the data used in the queries.. I just forged names. you can replace (the second file).

Surname 1
Student’s Name
Professor’s Name
Course
Date
CMIS 320 Project 3
This report includes five spool files (screenshots) which presents five main Oracle SQL procedures
of Create, Alter, Insert, Select, and finally Delete statements. SQL is also submitted have also
submitted SQL command for additional purposes.
Figure 1 below shows SQL commands that retrieve customers’ names, account numbers, and
addresses, sorted by account number

Surname 2
Figure 2 shows SQL statements that fetch entire videos rented in the last 30 days, sort them by
rental date order.

Figure 2: Select SQL statement

Surname 3
Figure 3 below shows SQL statements that retrieve a list of distributors and their data sorted in
order by company name

Figure 3: Sort SQL statement

Surname 4
Figure 4 below shows SQL statement that updates a customer name to alter their initial name to a
second one

Figure 4: Update SQL Statements

Surname 5

Figure 5 below shows a Spool file, with SQL statements that deletes a customer from the system
database.

Figure 5: DELETE SQL Statements


SQL> spool
Spooling to CMIS: Project3
SQL> SET ECHO ON
SQL> DROP TABLE Customer CASCADE CONSTRAINT;
Table dropped.
SQL>
2
3
4
5
6
7
8
9

CREATE TABLE Customer (
CustID varchar2(10) PRIMARY KEY,
Last_Name varchar2(10) not null,
First_Name varchar2(10) not null,
Street varchar2(20) not null,
City varchar2(20) not null,
State varchar2(2) not null,
Zip varchar2(5) not null,
Phone varchar2(10) not null);

Table created.
SQL> INSERT INTO Customer VALUES ('01', 'Smith', 'Adam', '121 Ilang St', 'Barrigada',
'CA', '96913', '6716868572');
1 row created.
SQL> INSERT INTO Customer VALUES ('02', 'Ember', 'Chris', '288 Biar Ln', 'Sun City',
'CA', '92467', '9518765654');
1 row created.
SQL> INSERT INTO Customer VALUES ('03', 'Lane', 'Ashley', '3421 Kingston', 'Old
Town', 'CA', '92584', '9514909822');
1 row created.
SQL> INSERT INTO Customer VALUES ('04', 'Griff', 'Brad', '76239 Nile Ct', 'Shape',
'CA', '96721', '6712947878');
1 row created.
SQL> INSERT INTO Customer VALUES ('05', 'Lyon', 'Tina', 'Lila Loop', 'Menifee', 'CA',
'96534', '9512190790');
1 row created.
SQL> SELECT * FROM Customer;
CUSTID
PHONE
-----------------01
6716868572
02
9518765654
03
9514909822
04
6712947878
05
9512190790

LAST_NAME

FIRST_NAME STREET

CITY

ST ZIP

---------- ---------- -------------------- -------------------- -- ----- Smith

Adam

121 Ilang St

Barrigada

CA 96913

Ember

Chris

288 Biar Ln

Sun City

CA 92467

Lane

Ashley

3421 Kingston

Old Town

CA 92584

Griff

Brad

76239 Nile Ct

Shape

CA 96721

Lyon

Tina

Lila Loop

Menifee

CA 96534

SQL> DROP TABLE Distributor CASCADE CONSTRAINT;
Table dropped.
SQL>
2
3
4
5
6
7
8
9

CREATE TABLE Distributor (
DistID varchar2(10) PRIMARY KEY,
Company varchar2(20) not null,
POC varchar2(20) not null,
Phone varchar2(10) not null,
Street varchar2(20) not null,
City varchar2(20) not null,
State varchar2(2) not null,
Zip varchar2(5) not null);

Table created.
SQL> INSERT INTO Distributor VALUES ('11', 'JM', 'Kyle Lee', '7823489218', '786 Cold
St', 'Gilly', 'WI', '67324');
1 row created.
SQL> INSERT INTO Distributor VALUES ('12', 'SDCD', 'Mike Weber', '8092343786', '1876
Juniper Ln', 'Fresno', 'CA', '925...


Anonymous
Excellent! Definitely coming back for more study materials.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags