Views and Constraints: Database modifications, Integrity constraints, triggers Notes | EduRev

: Views and Constraints: Database modifications, Integrity constraints, triggers Notes | EduRev

 Page 1


1 
Lecture 03 
Views, Constraints 
Tuesday, April 14, 2009 
Page 2


1 
Lecture 03 
Views, Constraints 
Tuesday, April 14, 2009 
Announcements 
•? Homework 1 was due a few minutes ago… 
•? Homework 2: due next week 
•? Homework 3: to be posted by tomorrow, due in 
two weeks 
2 
Page 3


1 
Lecture 03 
Views, Constraints 
Tuesday, April 14, 2009 
Announcements 
•? Homework 1 was due a few minutes ago… 
•? Homework 2: due next week 
•? Homework 3: to be posted by tomorrow, due in 
two weeks 
2 3 
Outline 
•? Database modifications, Integrity 
constraints, triggers (Chapter 5) 
•? Views: (Chapters 3.6,  25.8, 25.9) 
–? Some material discussed today is not in the 
book 
Page 4


1 
Lecture 03 
Views, Constraints 
Tuesday, April 14, 2009 
Announcements 
•? Homework 1 was due a few minutes ago… 
•? Homework 2: due next week 
•? Homework 3: to be posted by tomorrow, due in 
two weeks 
2 3 
Outline 
•? Database modifications, Integrity 
constraints, triggers (Chapter 5) 
•? Views: (Chapters 3.6,  25.8, 25.9) 
–? Some material discussed today is not in the 
book 
4 
Modifying the Database 
Three kinds of modifications 
•? Insertions 
•? Deletions 
•? Updates 
Sometimes they are all called “updates” 
Page 5


1 
Lecture 03 
Views, Constraints 
Tuesday, April 14, 2009 
Announcements 
•? Homework 1 was due a few minutes ago… 
•? Homework 2: due next week 
•? Homework 3: to be posted by tomorrow, due in 
two weeks 
2 3 
Outline 
•? Database modifications, Integrity 
constraints, triggers (Chapter 5) 
•? Views: (Chapters 3.6,  25.8, 25.9) 
–? Some material discussed today is not in the 
book 
4 
Modifying the Database 
Three kinds of modifications 
•? Insertions 
•? Deletions 
•? Updates 
Sometimes they are all called “updates” 
5 
Inserting One Record 
General form: 
Missing attribute ? NULL. 
 INSERT   INTO   R(A1,…., An)   V ALUES  (v1,…., vn) 
INSERT  INTO  Purchase(buyer, seller, product, store) 
               V ALUES  (‘Joe’, ‘Fred’, ‘wakeup-clock-espresso-machine’, 
                                   ‘The Sharper Image’) 
Example: Insert a new purchase to the database: 
Read More
Offer running on EduRev: Apply code STAYHOME200 to get INR 200 off on our premium plan EduRev Infinity!