Lab Record Students
Lab Record Students
COURSES Table
Q1: Create a table Courses that Contains information related to each course. Each course is given a
unique code called course code.
Q2: Create a table Faculty that Contains information about all the faculty members. Each faculty
member is given a code called as FACCODE.
FACCODE VARCHAR2(5) Faculty code. This is the primary key of the table.
COURSE_FACULTY table
Q3: Create a table Course_Faculty that Contains information regarding which faculty member can
take which course. A single faculty member may be capable of handling multiple courses. However,
each member is given a grade depending on his expertise in handling the subject. The grade will be
wither A, B or C.
Q4: Create a table Batches that Contains information about all the batches. These batches include
batches that were completed, that are currently running and that are scheduled but yet to start.
STDATE DATE Date on which the batch has started or scheduled to start
if batch has not yet started.
ENDDATE DATE Date on which the batch has completed. If batch is not
completed this will be null.
TIMING NUMBER(1) Number indicating the timing of the batch. 1- morning,
2 – after noon, and 3-evening.
STUDENTS table
Q5: Create a table Students that Contains information about all the students of the institute. Each
student is given a roll number. Roll number will be allotted to each student of each batch.
PAYMENTS table
Q6: Create a table Payments that Contains information about all the payment made by students of all
bathes.
Q1: Show the batch code, course code, end date of course and the date on which the students of completed
batches will be issued certificates assuming it will take 3 months time to issue certificates.
Q2: Display batch code, course code, start date, end date and the number of months between starting date
and ending date of all completed batches.
Q3: Displays the batches that we completed in the last 6 months and duration is more that 1 month.
Q4: Return the last day of the month in which batch has started and if 5 is added to that then it will be 5th of
the next month – due date of first installment.
Q5: Display the date of the next Friday.
Q6: Displays the details of the payments made today.
Nested Queries
Q1: Get the details of students who have paid today.
Q2: Display the details of batches handled by faculty name ‘Kevin Loney’.
Q3: Display the details of the faculty members who have not taken any batch in the last three months.
Q4: Display the details of faculty members who can handle course ora.
Q5: Display the details of batches that are taken by faculty with qualification MS or the course fee is more
than 5000.
Q6: Display the details of the students who belong to batches that are taken by faculty with qualification
MS.
Q7: Display the details of payments made by students of the batch that started on 12-jul-2001.
Q8: Display the details of the batches that have taken maximum duration among the batches of the same
course.
Q9: Get the details of course that has highest course fee.
Q10: Get the details of students who have made a payment in the last month but no in the current month.
Q11: Display the details of course with first two highest course fee.
Q12: Display the details of batches where duration (ENDDATE-STDATE) is more than the average
duration of the course.
Q13: Display third highest course fee.
Q14: Display the details of courses with two lowest fees.
EXISTS, Any operators
Q1: Display details of courses for which at least one batch started in this month.
Q2: Display the details of courses for which no batch has yes started.
Q3: Display name of the courses where FEE is more than FEE of any course with DURATION 25?
Views
1) Create a view that takes everything from COURSES table except FEE column.
2) Create a view called coursecount which consists of course, batchcount (no of batches for that
course), last date ( starting date of the last batch).
3) Display the courses for which we have started more than one batch so far using coursecount view.
4) Create a view called oraclebtaches which consists of details of only oracle batches.
5) Update enddate of batch b7 to sysdate by using view.
6) Delete the batch b1 using view.
7) Create a view months_payments which consists of each student payment details like rollno, name,
dp, amount.
8) Update amount paid by rollno1 to 4500 and truncate dp to ’12-sep-2019’.
9) Update name of the student bearing rollno 1 to Kotch George.
PL/SQL Programs
1) Write a PL/SQL program that uses a nested loop to find the prime numbers between 1 to n.
2) Write a PL/SQL block to change the course fee of VBNET with greatest of average course fee of all
courses and Oracle course fee.
3) Write a PL/SQL program that will update course fee of Java according to the given table.
4) Write a PL/SQL program that prints length of each student name using while loop.
5) Write a PL/SQL program that displays missing roll numbers ( which are not in STUDENTS table)
between lowest available rollno and largest available rollno in STUDENTS table using FOR loop.
6) Write a PL/SQL stored function that takes roll number of the student and return the amount yet to be
paid by the student.
7) Write a PL/SQL block to increase the fee of the courses which contains at least 3 students by 10%.
8) Write a PL/SQL cursor to display the name and qualification of the faculty who are teaching the
course called ‘Oracle Database’.
9) Write a PL/SQL cursor to test whether the specified batchcode is present or not.
10) Write a PL/SQL cursor to display the batch details having third place in payments.
11) Write a stored procedure that takes course code and returns the student name who joined first and
last in that course.
12) Create a package with two functions as given below along with exception handling mechanisms:
i) Change the fee of a given course with average of all course plus 10% that course.
ii) Return the faculty name who teaches the batch in which highest payment has been made.
13) Create an user defined exception that will be raised when there are no students in any batch of given
course.
14) Write a PL/SQL block which pays the remaining amount of a given student.
15) Write a PL/SQL block that prints reverse of the given number.
16) Write PL/SQL program to handle NO_DATA_FOUND exception.