Normalization of RDB tables Use SQL to Create a table with at least 4 attributes one of which is the Primary key. Then, insert 2 records into the table. Finally, use a select statement to show the content of your table after the inserts. Be sure your SQL statements work without issue and show each of of your statements. This course is CMIS 320 at UMUC, Relational Database Concepts and Apps, text book is Modern Database Management, 11th ed. fee is negotiable
Normalization of relational database tables is a crucial step in database design to ensure data integrity, reduce redundancy, and improve efficiency. By organizing data into tables and establishing relationships between them, normalization helps maintain consistency and accuracy in the database.
To illustrate the concept of normalization, I will provide an example by creating a table in SQL with at least four attributes, including a primary key. I will then insert two records into the table and use a select statement to demonstrate the content of the table after the inserts.
Before proceeding with the example, it is important to note that the SQL syntax may vary depending on the specific database management system (DBMS) used. In this case, I will assume the usage of standard SQL.
First, let’s create a table called “Employees” with the following attributes:
“`sql
CREATE TABLE Employees (
employee_id INT PRIMARY KEY,
employee_name VARCHAR(50),
department VARCHAR(50),
salary DECIMAL(10,2)
);
“`
In the above SQL statement, we have defined the “Employees” table with four attributes: “employee_id” (primary key), “employee_name”, “department”, and “salary”.
Next, let’s insert two records into the “Employees” table:
“`sql
INSERT INTO Employees (employee_id, employee_name, department, salary)
VALUES (1, ‘John Smith’, ‘Sales’, 50000),
(2, ‘Jane Doe’, ‘HR’, 60000);
“`
In the above SQL statement, we are inserting two records into the “Employees” table. The first record has an employee_id of 1, employee_name of ‘John Smith’, department ‘Sales’, and a salary of 50000. The second record has an employee_id of 2, employee_name of ‘Jane Doe’, department ‘HR’, and a salary of 60000.
Lastly, let’s use a select statement to display the content of the “Employees” table after the inserts:
“`sql
SELECT * FROM Employees;
“`
The above SQL statement will retrieve all rows and columns from the “Employees” table. It will display the content as follows:
“`
employee_id | employee_name | department | salary
————————————————-
1 | John Smith | Sales | 50000.00
2 | Jane Doe | HR | 60000.00
“`
In summary, we have successfully demonstrated the process of creating a table with at least four attributes, inserting two records, and using a select statement to display the table content after the inserts. This example provides a basic understanding of normalization and the practical implementation of SQL statements in database management.