Programming Assignment 2

Due Date:


Use the database presented in session 4. Use the create_grades.sql and insert_grades.sql to create and populate the tables.

Ex1: Write three queries for inserting records that would violate the table constrains: two for primary key (one null one double) and one for a foreign key.

Ex2: Write queries for the following:

Get the names of students enrolled in the Automata class in the f96 term
Get the course numbers and titles of courses in which Timothy Thomas has enrolled
Get the sid values of students who did not enroll in any class during the f96 term.
Get sid values of students who have enrolled in all courses in the catalog
Get the names of students who have not enrolled in any course
Get the student ids of students, terms and line numbers of courses they have enrolled in, the component names of the courses, the student scores in the components of the courses, and the weighted average of the component scores
Get the name of the courses that have been taugth at most two times.

--you may have to delete records from more then one table. Write a query for each table.
Update all the null-valued scores to zeros.
Drop the student with sid = 1234 from the f97 course with lineno = 1111.
Give all students in the f97 course with lineno = 1111 10 extra points in the EXAM1 component.