Green University of Bangladesh
Department of Computer Science and Engineering (CSE)
Faculty of Sciences and Engineering
Semester: (Spring, Year:2021), B.Sc. in CSE (Day)
LAB REPORT NO #01
Course Title: Database System Lab
Course Code: CSE 210 Section:201-DD
Lab Experiment Name: Table creation in Database System.
Student Details
Name ID
1. Md. Hasan Chowdhury 201002134
Lab Date : 23/02/2022
Submission Date : 01/03/2022
Course Teacher’s Name : Ms. Sultana Umme Habiba
Lab Report Status
Marks: ………………………………… Signature: .....................
Comments: .............................................. Date: ..............................
1. TITLE OF THE LAB EXPERIMENT
Table creation in Database System.
2. OBJECTIVES/AIM
Learn how to create Table. Also Insert, delete and update a table.
3. ANALYSIS
Alter Command: It’s a command which is very useful when you want to change a
name of your table, any table field or if you want to add or delete an existing
column in a table.
Unique Key: A unique key is a set of one or more than one fields/columns of a
table that uniquely identify a record in a database table.
Primary Key: The primary key constraint uniquely identifies each record in a
table. Primary keys must contain unique values, and cannot contain null values.
Foreign Key: A foreign key is a column or group of columns in a relational
database table that provides a link between data in two tables. It acts as a cross-
reference between tables because it references the primary key of another table,
thereby establishing a link between them.
4. IMPLEMENTATION
Code:
CREATE DATABASE Practice;
CREATE table Workers (
Name varchar(100),
Shift varchar(100),
Adress varchar(100),
Mobile int PRIMARY KEY);
DESCRIBE workers;
ALTER TABLE workers ADD NID int(13) UNIQUE KEY
INSERT INTO workers
VALUES
('Karim','Night','Mohakhali, Dhaka', 01863443212, 111111111),
('Rahim,','Day','Dhanmondi, Dhaka', 01863444534, 22222222),
('Kuddus','Night','Taltola, Dhaka', 01863449232, 00000000000),
('Jahangir','Night','Mohakhali, Dhaka', 01863745672, 5555555555);
DESCRIBE workers;
UPDATE workers SET Shift='Day' WHERE Name='Kuddus';
DELETE FROM workers WHERE Name='Jahangir';
DESCRIBE workers;
CREATE TABLE Salary(
Name varchar(100),
Ammount int NOT null,
Mobile int ,
FOREIGN KEY(Mobile) REFERENCES workers(Mobile));
DESCRIBE salary;
5. OUTPUT
First table named workers, after inserting values and deleting one raw and updating
a value. And also setting the Primary key and Unique key.
Second table named salary which has the Foreign key.
6. ANALYSIS AND DISCUSSION
Learned how we can create a table. Insert values as well as delete or update the
table or it’s values. We also learned about Primary key, Foreign key and unique
key.