Attempt All Question Carry Equal Marks.: DBMS (Lab Mid) Quiz#01

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

DBMS (Lab Mid)

Quiz#01
---------------------
Department: CS & IT Total Marks: 10 Marks
Course Instructor: Mr. Asif Raza Time Allowed: 30 minutes

Attempt all Question carry equal marks.

1) RUN THESE QUERIES and IDENTIFY ERRORS FROM THEM

Create table Student(


Std_ID int primary key,
sname varchar(100),
major varchar(50),
age int(12))

Create table faculty(


F_ID int primary key,
fname varchar(100),
jobtitle varchar(50),
sal int,
dept_ID int
)

Create table class(


cname varchar(50) primary key,
room varchar(50),
F_ID int references student(F_ID))

Create table enrolled(


Std_ID int references Student(StdID),
cname varchar(50) references class(cname),
dateFrom,
dateTo date,
primary key(Std_ID, cname))
2) Insert some data in each table (2-3 rows) and display database diagram.
3) Add a new column (S_email ‘must have@’) in student table and
(f_address ‘must have at end -PAK’) in faculty table.
4) Rename table enrolled to Registration and rename column sal to salary in
faculty table.
5) Write SQL query that shows faculty information in the following pattern.
Dept_ID JobTitle Salary 2*Salary+500 Faculty Name

6) Display the record of faculty having salary greater than 2000 but not 4000.
7) Show the record of student whose name having character ‘as’(s always 2nd
last) OR whose name start with character a, 3rd d,5th l and end with T.
8) Write SQL syntax for update and delete a record. (you may give example)
9) Create give below RDBMS Schema.

You might also like