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"

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter7: Database Administration
Section: Chapter Questions
Problem 11TD: Toys Galore currently has a credit limit of 7,500. Because Toys Galore has an excellent credit...
icon
Related questions
Question

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"

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Complex Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning