



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
THESE ARE SOME BASIC DATABASE LABS ASSIGNMENT EASY FOR BEGINNERS..THEY CONTAIN OUPUT PICS AND CODE AS WELL
Typology: Lab Reports
1 / 5
This page cannot be seen from the preview
Don't miss anything!




EXPERIMENT 3A – Data Definition Languages Lab# 3A EXCERCISE (15 marks) Problem 3A.1 : SQL Query: create table Employee( Empn varchar( 15 ), EmpName varchar( 20 ), Designation char( 20 ), Deapartment char( 20 ), Email varchar( 30 ), Phone varchar( 20 ), Constraint EmpId Primary Key(Empn) ) insert into Employee values ('E- 100','Chuck','Coordinator','Administration','[email protected]',' -3333'), ('E-101','Mary','Manager','Finance','[email protected]', '523- 1111'), ('E-102','Sally','Supervisor','Planning','[email protected]','523-2222'), ('E- 103','Alan','Adminstrator','Administratio','[email protected]','523- 3333'), ('E-104','Qasim','Assistant','Finance','[email protected]','523-1111') select * from employee Table:
Self Referencing entity is also known as Recursive entity. It defines the relationship between the same entity or table as shown in figure. You are required to take any one example of self reference entity and implement it using MS SQL Server. Moreover, enter five sample records. Query create table Student( StudentID varchar( 10 ), FirstName varchar( 30 ), LastName varchar( 30 ), City char( 15 ), Std_State char( 3 ), StudentIDD varchar( 10 ), Constraint StdID Primary key(StudentID), Constraint Pre_StdID Foreign key(StudentIDD) references Student(StudentID) ) insert into Student values insert into Student values ('S-001','Hadeed','Naeem','Sialkot','PU',null), ('S-002','Ahmed','Suleman','Sialkot','PU','S-001'), ('S-003','Ehtisham','Ahmed','Okara','PU','S-002'), ('S-004','Haris','Rauf','Peshawar','KPK','S-001'), ('S-005','Babar','Azam','Karachi','Sd','S-004') select* from Student Table output :
Diagram of Self reference entity :