Database Lab CLP

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Green University of Bangladesh

Department of Computer Science and Engineering


CSE 210 : Database System Lab

Lab CLP

Submitted by:
Name Md. Rokibul Hossain Tuhin

Student ID 213002024

Section 213 D19

Date of Submission : 19/12/2023

Submitted to :
Md. Zahidul Hasan

Lecturer, Dept. of CSE


TASK

Code:
create table Student (
student_id int primary key ,
name varchar(50) not null
);
create table Teacher (
teacher_id int primary key,
name varchar(50) not null,
salary int ,
email varchar(70) not null
);

create table Course (


course_code int primary key ,
title varchar(80) not null
);

create table Section (


sec_id int primary key,
teacher_id int,
course_code int,
FOREIGN KEY (teacher_id) REFERENCES Teacher(teacher_id),
FOREIGN KEY (course_code) REFERENCES Course(course_code)
);
create table SectionData (
sec_id INT,
student_id INT,
FOREIGN KEY (sec_id) REFERENCES Section(sec_id),
FOREIGN KEY (student_id) REFERENCES Student(student_id)
);

insert into Student(student_id, name)


values
(213002022,"md korim"),
(213002024,"md tuhin");

insert into Teacher(teacher_id, name, salary, email)


values
(321,"MD Hasmot",200000,"mdhasmot456@gmai;.com"),
(322,"MD Jakir",220000,"mdjakir85@gmail.com");

insert into Course(course_code, title)


values
(310,"web programming"),
(311,"web programming lab");

insert into Section(sec_id, teacher_id, course_code)


values
(205,321,310),
(206,322,311);

insert into Sectiondata(sec_id, student_id)


values
(205,213002022),
(206,213002022),
(205,213002024);

Output :

You might also like