Normalization : Normalization is process of decomposing of large and complex table in simple and smaller form.Before normalization data is row data or data in textfile.Normalization helps to reduce redundancy and avoid inconsistancy of data.
Question 1 :
1. Given Order_Product table is in the First Normal form (1NF) because all the columns in the table are automic in nature thus means no column contains multiple values and each row is having only one column also no duplicate columns are there.
2.Update anomaly : Here in the table couple of rows in tables having duplicate values like Order_ID but want to update a record with Order_ID OD100 then three rows will get updated.
Delete Anomaly :Likewise if want to delete a record with Order_ID100 three rows will get deleted.Same case happen with OD121.
Insert Anomaly : There is no specific way how Order_ID will generate also if a customer want to order all the items then there is problem duplicate rows exits.
Below is the normalization of this table in 3NF.
First Normal Form (1NF):
In First Normal Form (1NF) all the columns in the table should be atomic in nature that means each column should contain one value & each row should contain the same number of columns. Repeating groups or duplicate columns are not allowed in first normal form.
Above table is in the First Normal Form (1NF). Because each row have only one value and no repeating group of column are in the table.
Second Normal Form (2NF):
Second Normal Form (2NF) should full fill requirements of first normal form (1NF) and all the columns in the table should functionally depend upon primary key column in the table. Partially dependencies are not allowed in second normal form
Here Product_Desc and Unit_Price and depends upon product_ID hence need to separate these into another table.
1.Table Name : Product
Schema : Product_ID -Primary key , Product_Desc, Unit_Price
Below is the table data
Product_ID Product_Desc Unit_Price
E34T098 Coffee Table $175.00
N78S571 Nightstand $150.00
B66K881 Bookcase $200.00
D87D729 Drawer Dresser $225.00
2.Table Name : Order
Schema : Order_ID-Primary key , Order_Date
Below is the table data
Order_ID Order_Date
OD100 09/08/2000
OD213 01/01/2001
OD121 12/20/2000
Third Normal Form (3NF):
In Third Normal Form (3NF), It should full fill all the requirements of second normal form and all the columns in the table should be depend upon primary key column. Transitive dependency are not allowed in the 3NF. Transitive dependency means non key column depends upon non key column in the table.
Here primary key of one table is used as foreign key in another table to form a relation as shown below.
Table Name : OrderDetails
Schema : OrderDetailsID-Primary key , OrderID-Foreign key ,ProductID-Foreign Key , Quantity
Below is the table data for the table OrderDetails
OrderDetailsID OrderID ProductID Quantity
1 OD100 E34T098 2
2 OD100 N78S571 3
3 OD100 B66K881 2
4 OD213 B66K881 1
5 OD121 D87D729 2
6 OD121 E34T098 3
Question 2 :
Given table is in the first Normal Form (1NF)
First Notmal form (1NF) : Given table is in the first normal form because all the columns in the table is automic in nature no duplicated columns are there.
Second Normal Form (2NF) : Here this table needs to separate into two tables because name is depends upon CustomerID and Region depends upon Salesperson hence need to have in separate table so below are the tables in Second Normal Form(2NF).
1.Table Name : Customer
Schema : Customer_ID - Primary key , Name
Below is the table data
Customer_ID Name
8023 Anderson
9167 Bancroft
7924 Hobbs
6837 Tucker
8596 Eckersley
7018 Arnold
2.Table Name : Salesperson
Schema :SalespersonID-Primary key ,Salesperson, Region
below is the table data
SalespersonID Salesperson Region
101 Smith South
102 Hicks West
103 Hernandez East
104 Faulb North
Third Normal Form (3NF) : Tables in 3NF are used to form a relation that means primary key of one table is used as foreign key in another table as given below.
Table Name : CustomerSales
Schema :CustomerSalesID-Primary Key , Customer_ID-Foreign key , SalespersonID-Foreign key
Below is the table data
CustomerSalesID Customer_ID SalespersonID
1 8023 101
2 9167 102
3 7924 101
4 6837 103
5 8596 102
6 7018 104
Chapter 6 Homework Answer the questions below Note In drawing the diagrams, use the textbook nota...
Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...