$24
• INSTRUCTIONS
(1) This lab is graded.
(2) Use the student database that was created in Lab1.
• QUESTION 1
Consider the following relations:
Student(snum: integer, sname: string, major: string, level: string, age: integer)
Class(name: string, meets_at: time, room: string, fid: integer)
Enrolled(snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class.
(1) Write a Java application that creates a new table called Student1 and adds students to Student1. Accept the required inputs from the user. Also, create a table called NewEnrolled, which has the same attributes as Enrolled. Use the first five table rows given to you for Student as inputs to be entered from the command line. [5 Marks]
(2) Write a java application that does the following: Use the table Student1 for this question.
(a) Accept a student id from the user. If the id does not exist in Student1, print an error message.
(b) If it exists, print the complete row corresponding to that id and the classes for which that student has enrolled, by referring to Enrolled.
(c) If the student has not enrolled for any classes, list the available classes and ask for a class name to enroll. Enroll the student in the given class by making an entry in NewEnrolled.
[3*5 Marks]
(3) Write a java application to add a relation student_research(snum, paper_id) in to the lab 1 database.
Insert the given tuples into the relation from the application. The given papers must be stored in the database. [5 Marks]
(4) Write a java application to retrieve all the papers of a given student from the database. Retrieving the paper id is not sufficient, the paper must be retrieved. [5 Marks]
.
1