0% found this document useful (0 votes)
2 views2 pages

Program 6

The document outlines the process of creating and normalizing a database table for student records. It starts with an unnormalized table (UNF) for students and their courses, then demonstrates how to convert it to First Normal Form (1NF) and subsequently to Second Normal Form (2NF) by creating separate tables for students, courses, and enrollment. Data insertion examples are provided for each stage of normalization.

Uploaded by

sarojinisri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Program 6

The document outlines the process of creating and normalizing a database table for student records. It starts with an unnormalized table (UNF) for students and their courses, then demonstrates how to convert it to First Normal Form (1NF) and subsequently to Second Normal Form (2NF) by creating separate tables for students, courses, and enrollment. Data insertion examples are provided for each stage of normalization.

Uploaded by

sarojinisri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Create Unnormalized Table (UNF)

CREATE TABLE STUDENT_UNF (

StudentID INT,

StudentName VARCHAR(50),

Course1 VARCHAR(50),

Course1_Marks INT,

Course2 VARCHAR(50),

Course2_Marks INT

);

Insert Data into UNF


INSERT INTO STUDENT_UNF

VALUES (1, 'Rahul', 'DBMS', 85, 'OS', 78);

Convert UNF First Normal Form (1NF)


CREATE TABLE STUDENT_1NF (

StudentID INT,

StudentName VARCHAR(50),

CourseName VARCHAR(50),

Marks INT

);

Insert Data into 1NF Table


INSERT INTO STUDENT_1NF VALUES (1, 'Rahul', 'DBMS', 85);

Convert 1NF Second Normal Form (2NF)


CREATE TABLE STUDENT6 (

StudentID INT PRIMARY KEY,

StudentName VARCHAR(50)

);
COURSE Table
CREATE TABLE COURSE (

CourseID INT PRIMARY KEY,

CourseName VARCHAR(50)

);

ENROLLMENT Table
CREATE TABLE ENROLLMENT (

StudentID INT,

CourseID INT,

Marks INT,

PRIMARY KEY (StudentID, CourseID)

);

insert Data into 2NF Tables


INSERT INTO STUDENT6 (StudentID, StudentName)

VALUES (2, 'Anita');

display for unnormalized


SELECT * FROM STUDENT_UNF;

You might also like