Consider following database schema and write SQL query for each of the statement given below. Student (regNo, sName, sCity, sCGPA, sAge) Course ( Code, Name, credit_hours) Enrollment (regNo, Code, semester,quality_points, Grade) Statements; 1- Write a procedure which must insert values in Student table. After insertion, you must check whether inserted value is stored more than once or not. If count of inserted value exists more than once, system must 'ROLLBACK' and inserted value must be deleted by system. 2-Write a procedure which must perform following task a. Insets 6 records in Enrollment table (each record for the course enrolled in current semester). b. If any of insert statement fails due to any constraint (primary key, foreign key, check), all inserted data must be reverted by using "ROLLBACK"
Consider following
Student (regNo, sName, sCity, sCGPA, sAge)
Course ( Code, Name, credit_hours)
Enrollment (regNo, Code, semester,quality_points, Grade)
Statements;
1- Write a procedure which must insert values in Student table. After insertion, you must
check whether inserted value is stored more than once or not. If count of inserted value
exists more than once, system must 'ROLLBACK' and inserted value must be deleted by
system.
2-Write a procedure which must perform following task
a. Insets 6 records in Enrollment table (each record for the course enrolled in current
semester).
b. If any of insert statement fails due to any constraint (primary key, foreign key,
check), all inserted data must be reverted by using "ROLLBACK"
Trending now
This is a popular solution!
Step by step
Solved in 3 steps