DBMS Assignment - 1
DBMS Assignment - 1
15. What are integrity constraints? Why are they necessary in DBMS?
16. Explain the differences between NOT NULL, UNIQUE, and CHECK constraints with
examples.
17. What is a primary key? How is it different from a unique key?
18. Define and differentiate between candidate key, super key, and alternate key.
19. What is a composite key? Provide an example.
20. How does a foreign key ensure referential integrity? Give an example with SQL.
21. Consider the following schema and Write the Queries in Both Relational Algebra & SQL:
i. Find the names of students whose name starts with the letter 'S'.
ii. Find all distinct student names and departments who are above 22 years old or have
a CGPA greater than 3.80.
iii. Find the names and departments of students who are either in the CSE or EEE
Department and have a CGPA above 3.50.
iv. Find the total number of students in the database.
v. Find the names of courses that have credit hours greater than 3 but are not in the
Business department.
vi. Find the names of students who are enrolled in the same department as a course
with credit hours greater than 4.
22. Consider the following schema and Write the Queries in Both Relational Algebra &
SQL:
i. Find the names of employees whose name starts with the letter 'A'.
ii. Find all distinct employee names and departments who are above 35 years old or
have a salary greater than 75,000.
iii. Find the names and departments of employees who are either in the IT or HR
Department and have a salary above 50,000.
iv. Find the total number of employees in the database.
v. Find the names of projects that have a budget greater than 5 million but are not in
the Finance department.
vi. Find the names of employees who work in the same department as a project with
a budget greater than 10 million.
23. Consider the following schema and Write the Queries in Both Relational Algebra &
SQL:
i. Retrieve the list of all unique students who are enrolled in either Course_A or
Course_B.
ii. Rename the attribute as_name to student_name in the Course_A table.
iii. Find students who are enrolled in Course_A but not in Course_B.
iv. Find students who are enrolled in both courses.
N.B. Do not copy-paste from your friends. Go through the PDF and understand the questions
before answering them.