Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Attributes that form part of the key are listed with a *; the * is not part of the actual attributename. Grades and GPAs are

image text in transcribed

image text in transcribed

Attributes that form part of the key are listed with a *; the * is not part of the actual attributename. Grades and GPAs are numeric.

1. Consider the following database schema describing students enrolled in sections of classes at a university. student (sid*, sname, sex, age, year, gpa) [Year is a number between 1 and 5). dept(dname*, numphds) prof(pname*, dname) course(cno*, cname, dname*) (Course numbers are unique within departments.] major(dname*, sid*) section(dname*, cno*, sectno*, pname) (Associates an instructor to a section.] enroll(sid*, grade, dname*, cno*, sectno*) (Associates students to sections. (a) Write an SQL assertion statement to check the constraint that a student cannot have more than two majors. (b) Write an SQL assertion statement to check the constraint that every department must have at least one professor. Explain how this assertion might relate to a total participation constraint on a corresponding entity-relationship diagram. (C) Suppose that the table "dept" has an additional attribute "budget. Write a trigger that adds $5 to the budget of the department each time a new student signs up for one of that department's classes, and a second trigger that subtracts $5 when a student drops such a class. 1. Consider the following database schema describing students enrolled in sections of classes at a university. student (sid*, sname, sex, age, year, gpa) [Year is a number between 1 and 5). dept(dname*, numphds) prof(pname*, dname) course(cno*, cname, dname*) (Course numbers are unique within departments.] major(dname*, sid*) section(dname*, cno*, sectno*, pname) (Associates an instructor to a section.] enroll(sid*, grade, dname*, cno*, sectno*) (Associates students to sections. (a) Write an SQL assertion statement to check the constraint that a student cannot have more than two majors. (b) Write an SQL assertion statement to check the constraint that every department must have at least one professor. Explain how this assertion might relate to a total participation constraint on a corresponding entity-relationship diagram. (C) Suppose that the table "dept" has an additional attribute "budget. Write a trigger that adds $5 to the budget of the department each time a new student signs up for one of that department's classes, and a second trigger that subtracts $5 when a student drops such a class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions