0% found this document useful (0 votes)
7 views6 pages

Home Work Answers

Here are the key steps to relate the 4 tables in the database: 1. The Student table contains student details like student number, name, address and phone. 2. The Lecturer table contains lecturer details like lecturer number, name, address and phone. 3. The Class table contains class details like class number, lecturer number (foreign key referencing Lecturer table), room number, time and fee. 4. The Enrolment table contains student enrollment details like student number (foreign key referencing Student table), course level, subject and class number (foreign key referencing Class table). This relates the 4 tables - Student, Lecturer, Class and Enrolment where:

Uploaded by

James Kaunda
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)
7 views6 pages

Home Work Answers

Here are the key steps to relate the 4 tables in the database: 1. The Student table contains student details like student number, name, address and phone. 2. The Lecturer table contains lecturer details like lecturer number, name, address and phone. 3. The Class table contains class details like class number, lecturer number (foreign key referencing Lecturer table), room number, time and fee. 4. The Enrolment table contains student enrollment details like student number (foreign key referencing Student table), course level, subject and class number (foreign key referencing Class table). This relates the 4 tables - Student, Lecturer, Class and Enrolment where:

Uploaded by

James Kaunda
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
You are on page 1/ 6

<< Search more Solutions!

Answer
i. Draw a diagram that shows how these four tables are related to each other.

Create the database with DB name of CUZ2022, using scripting\

Create Database CUZ2022;

iii. Create all the relations using scripting

create table Student(StudentNo int primary key, Name char(20), Address char(20),
Phone char(20));
create table Lecturer (LecturerNo int primary key, LecturerName char(20), Address
char(20), Phone char(20));

create table Class ( ClassNo int primary key,


LecturerNo Int REFERENCES Lecturer (LecturerNo), RoomNo int,
Time date, Fee float);

create table Enrolment(StudentNo int REFERENCES Student(StudentNo) ,


CourseLevel char(20) , Subject char(20), ClassNo int REFERENCES
Class(ClassNo)) ;

iv. Insert at least 10 records in each of the relations using scripting.

Insert into Student values(1,'Smith','C2','1234');


Insert into Student values(2,'John','r2','1234');
Insert into Student values(3,'King','u2','1234');
Insert into Student values(4,'Karul','w2','1234');
Insert into Student values(5,'roe','r2','1234');
Insert into Student values(6,'Ammi','e2','1234');
Insert into Student values(7,'Raj','k2','1234');
Insert into Student values(8,'Kal','l2','1234');
Insert into Student values(9,'pink','s2','1234');
Insert into Student values(10,'mark','a2','1234');

select * from Student;


Insert into Lecturer values(100,'A','Xy123','6789');
Insert into Lecturer values(101,'X','qw45','7779');
Insert into Lecturer values(102,'E','gh678','8889');
Insert into Lecturer values(103,'T','hj90','9999');
Insert into Lecturer values(104,'Q','op6778','22222');
Insert into Lecturer values(105,'F','34ghh','33333');
Insert into Lecturer values(106,'H','45cv','7777');
Insert into Lecturer values(107,'S','Xy123','899');
Insert into Lecturer values(108,'A','Xy123','11111');
Insert into Lecturer values(109,'Y','Xy123','78945');
Insert into Class values(111,100,201,'12.00',2000.0);
Insert into Class values(112,101,200,'1.05',2890.0);
Insert into Class values(113,102,201,'12.45',5500.0);
Insert into Class values(114,103,205,'12.78',6500.0);
Insert into Class values(115,104,206,'14.00',7000.0);
Insert into Class values(116,105,207,'8.00',6000.0);
Insert into Class values(117,106,208,'5.00',2500.0);

select * from class;


Insert into Enrolment values(1,'Level 1','CS',111);
Insert into Enrolment values(1,'Level 2','AI',112);
Insert into Enrolment values(2,'Level 3','MA',113);
Insert into Enrolment values(2,'Level 3','RK',114);
Insert into Enrolment values(3,'Level 3','SA',115);
Insert into Enrolment values(4,'Level 2','CA',111);
Insert into Enrolment values(5,'Level 3','CS',112);

select * from Enrolment;


Thank u

You might also like