DBMS Viva Questions
DBMS Viva Questions
PRACTICE QUESTIONS:
7. Truncate the data from the "Orders" table, keeping the table structure intact.
VIVA - QUESTIONS:
Que1. What is a NULL value and how does it differ from a zero value?
VIVA – QUESTIONS:
PRACTICE QUESTIONS:
VIVA- QUESTIONS:
Schema:
Sales
1. Calculate the total quantity sold for each product, but only show products with a
total quantity sold greater than or equal to 25.
2. Count the number of sales for each product and sales date, but only show those
with more than one sale on any date.
3. Find products that have never sold more than 10 units in a single sale.
4. Calculate the total quantity sold for each product and show only those with an
average quantity sold less than or equal to 15 units.
VIVA – QUESTIONS:
PRACTICE QUESTIONS:
1. Find all information of sailors who have reserved boat number 101.
2. Find the name of boat reserved by Bob.
3. Find the names of sailors who have reserved a red boat, and list in the order of age.
4. Find the names of sailors who have reserved at least one boat.
5. Find the ids and names of sailors who have reserved two different boats on the same day.
6. Find the ids of sailors who have reserved a red boat or a green boat.
7. Find the name and the age of the youngest sailor.
8. Count the number of different sailor names.
9. Find the average age of sailors for each rating level.
10. Find the average age of sailors for each rating level that has at least two sailors.
VIVA - QUESTIONS:
PRACTICE QUESTIONS:
1. Retrieve the details of students who have scored the highest marks in each subject.
2. Find the courses taken by students from a specific city.
3. Retrieve the names of students who have taken all available courses.
4. Find the courses with the highest enrolment.
5. Get the list of students who have scored lower than the average score in all subjects.
6. Retrieve the names of students who have not registered for a specific course.
7. Find the courses with no registered students.
8. Retrieve the names of students who have registered for all courses in a specific
department.
VIVA - QUESTIONS:
PRACTICE QUESTIONS:
1. Retrieve a list of student names from the "students" table, excluding those present in
the "new_students" table.
2. Combine the names of students from the "students" and "new_students" tables,
including duplicates.
3. Get the names of students who are either in the "students" table or in the
"new_students" table, but not in both.
4. Retrieve a list of student names who have registered for at least one course from
either the "students" or "new_students" tables.
5. Combine the student names from the "students" and "new_students" tables,
including duplicates, and sort the result in ascending order.
6. Retrieve the student names from the "students" table who have not registered
for any courses.
7. Get the names of students who are present in both the "students" table and
the "new_students" table, including duplicates.
VIVA - QUESTIONS:
1. What is the difference between the UNION and UNION ALL operations in DBMS?
2. How does the INTERSECT operation work in DBMS, and what is its purpose?
3. Explain the EXCEPT (or MINUS) operation in DBMS and provide an example.
4. Can you combine multiple set operations in a single query? If so, provide an example.
5. What happens if the SELECT statements in a set operation have different column
names or incompatible data types?
Aim: Write the queries to create the views and queries based on views
PRACTICE QUESTIONS:
Table: Students
Table: Departments
1. Write an SQL query to create a view named "Student Grades" that retrieves the Student
ID, Student Name, and Grade from the Students table.
2. Write an SQL query to retrieve the contents of the "Student Grades" view created in the
previous question.
3. Write an SQL query to create a view named "Top Students" that retrieves the Student ID,
Student Name, and Grade of students who have a grade of "A".
4. Write an SQL query to retrieve the contents of the "Top Students" view created in the
previous question.
5. Write an SQL query to create a view named "Department Summary" that retrieves the
Department ID, Department Name, and the total number of students in each department.
6. Write an SQL query to retrieve the contents of the "Department Summary" view created
in the previous question.
7. Write an SQL query to create a view named "Top Scoring Departments" that retrieves
the Department ID, Department Name, and the average grade of students in each department,
sorted in descending order by the average grade.
VIVA - QUESTIONS:
3. Write a PL/SQL block that uses a FOR loop to display the numbers
from 1 to 10 on separate lines.
4. Write a PL/SQL block that uses a WHILE loop to display the even
numbers between 1 and 20 on separate lines.
PRACTICE QUESTIONS:
VIVA - QUESTIONS:
6. What are the modes for passing parameters to stored Procedure or Function?
1. Write a PL/SQL trigger that fires before inserting a new record into
a table named "Employees." The trigger should automatically set the
"created_date" column to the current date and time.
VIVA - QUESTIONS: