1 / 3

Constraints & Triggers

Constraints & Triggers. Active elements: executes as appropriate Database integrity: insert/delete/update # of students > 3.0 < 30% name should not have numbers or special characters We must have basic data (name, gender) about students who enroll in courses

awen
Télécharger la présentation

Constraints & Triggers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Constraints & Triggers

  2. Active elements: executes as appropriate • Database integrity: insert/delete/update • # of students > 3.0 < 30% • name should not have numbers or special characters • We must have basic data (name, gender) about students who enroll in courses • Student status is either active or inactive • Student name can never be null • If you delete a course then all enrollment records for that course should be deleted OR CID should be converted to null • The number of credits a student can take in a semester should be between 6 and 15. • An attribute of Course. Course(CID, title, avgGrade)

  3. Create table course ( course_id char (5) primary key, title varchar(20), deptvarchar (20) references department (name) ) • Create table course ( course_id char (5) primary key, title varchar(20), deptvarchar (20), FOREIGN KEY (dept) REFERENCES department (name) on delete set null on update cascade ) Create table department ( did int primary key, namevarchar (20) unique, address varchar (40) )

More Related