SQL Test PaperJanuary
SQL Test PaperJanuary
Instructions:
1. Solve any 8 query.
2. To take 10 record from each table.
Q1. Write SQL Query to display all courses whose fees are 15000, 22000 and 25000?
Q2. Write SQL query to display the course in which at least 3 character?
Q3. Write SQL Query to display the course wise student list?
Q4. Write SQL Query to show the Student count Course Wise?
Q5. Write SQL Query to show the course list who having more than 3 students?
Q6. Write SQL Query to show the all student list who having more than 3 lakh packages?
Q7. Create a stored procedure that inserts a new student into the Student table and calculates a discount
for the course fee based on the student’s enrollment. The discount should be 10% if the student’s contact
number starts with "123", otherwise no discount.
Q8. Write a stored procedure to update the fees of a student based on the course they are enrolled in.
The procedure should take the student ID and course ID as input, and the procedure should update the
fees of the student to the corresponding course fee.
Q9. Create a trigger that prevents the deletion of a student from the Student table if they are currently
enrolled in any course (i.e., they have an entry in the Csjoin table). If the student is enrolled in any course,
the deletion should be blocked and an error message should be raised.
Q10. Create a view that displays the names of students along with the courses they are enrolled in. The
view should join the Student, Course, and Csjoin tables.