You are on page 1of 5

ITS 4300 Assignment – SQL 2

Directions:
Imple me nt the 3 r d NF of the be low table using Oracle SQL Live .
Paste a scre e nshot of the re qu ire d SQL state me nts and outputs.
Ensure you capture your use rname at the top right corne r of Oracle SQL Live .
Full Name Address Books Purchased Name Prefix
Bill G ate s 435 5 th Ave , Chicago Windows Basics, Mr.
Maste ring iOS,
Te rraforming Mars
Je nnife r Lope z 12 Malibu Drive , Austin Brave Ne w World, Ms.
SQL Fun, Magic
Bre aks
Je nnife r Lope z 99 Ele rson Rd, Austin Alanna: Origins Ms.

Display the first name , last name , and books purchase d in de sce nding orde r like this once you
cre ate the table s :

Normalization Form (3 NF)- Remove Transitive Dependency

Table 1- Prefix Table

Creation code:

Create Table Name_Prefix (

Name_Prefix_ID number,
Name_Prefix varchar2(50),

constraint Pk_employees_deptno Primary Key (Name_Prefix_ID)

);

Type of Data Inserted:


Insert INTO Name_Prefix (Name_Prefix_ID, Name_Prefix)

Values ('001', 'Mr.');

Insert INTO Name_Prefix (Name_Prefix_ID, Name_Prefix)


Values ('002', 'Ms.');

Table 2- Person Table

Creation code:

Create Table Person (


Person_ID number not null,

First_Name varchar2(50),

Last_Name varchar2(50),

Street_Address varchar2(50),
City varchar2(50),

Name_Prefix_ID number,

constraint pk_person Primary Key (Person_ID),

constraint fk_employees_deptno Foreign Key (Name_Prefix_ID)


references Name_Prefix (Name_Prefix_ID)

);
Type of Data Inserted:

Insert INTO Person (Person_ID, First_Name, Last_Name, Street_Address, City, Name_Prefix_ID)

Values ('1', 'Bill', 'Gates', '435 5th Ave', 'Chicago', '001');

Insert INTO Person (Person_ID, First_Name, Last_Name, Street_Address, City, Name_Prefix_ID)

Values ('2', 'Jennifer', 'Lopez', '12 Malibu Drive', 'Austin', '002');

Insert INTO Person (Person_ID, First_Name, Last_Name, Street_Address, City, Name_Prefix_ID)

Values ('3', 'Jennifer', 'Lopez', '99 Elerson Rd', 'Austin', '002');

Table 3- Books Purchased Table

Creation code:

Create Table Books_Purchased (


Person_ID number,

Books_Purchased varchar2(50)

);

Type of Data Inserted:


Insert INTO Books_Purchased (Person_ID, Books_Purchased)

Values ('1', 'Windows Basics');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)

Values ('1', 'Mastering iOS');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)


Values ('1', 'Terraforming Mars');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)

Values ('2', 'Brave New World');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)

Values ('2', 'SQL Fun');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)

Values ('2', 'Magic Breaks');

Insert INTO Books_Purchased (Person_ID, Books_Purchased)


Values ('3', 'Alanna: Origins');
Select Statement- To display the first name, last name, and books purchased in descending order

You might also like