




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





































Lecture 8: Updates and Constraints
Update operations and the constraints they can violate [E&N §5.3] Example student database UML for this SQL examples of constraint violation (see studentEg*.sql files)
See the Postgress documentation Chapter 5 (its available on the Labs page)
Thanks for writing down your feedback last week. Here is a summary:
yes no overview helped 66 11 know what to expect 52 21 oversimplified 15 60 understood lecture 5 65 9
96 responses in total
25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working
25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working 6 people want the slides well in advance of the lectures
25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working 6 people want the slides well in advance of the lectures 6 people want exam-like example questions, past papers, revision lectures 5 people want set readings or more references to the text
25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working 6 people want the slides well in advance of the lectures 6 people want exam-like example questions, past papers, revision lectures 5 people want set readings or more references to the text 2 people do nice origami (especially the swan)
25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working 6 people want the slides well in advance of the lectures 6 people want exam-like example questions, past papers, revision lectures 5 people want set readings or more references to the text 2 people do nice origami (especially the swan) 1 person says I suck and 1 person says I look like this guy
A database state represents the state of the world.
A database state represents the state of the world.
The world changes, and so must our databases. Thus we have update operations. insert a tuple into a relation delete a tuple from a relation
A database state represents the state of the world.
The world changes, and so must our databases. Thus we have update operations. insert a tuple into a relation delete a tuple from a relation update the value of an attribute of a tuple in a relation
Read some SQL reference such as Chapter 5 of the Postgres documentation.
INSERT INTO student (name, studentNumber, class, major) VALUES (’MacLane’, 200001, 1930, ’maths’);
DELETE FROM course WHERE courseNumber=1;
Read some SQL reference such as Chapter 5 of the Postgres documentation.
INSERT INTO student (name, studentNumber, class, major) VALUES (’MacLane’, 200001, 1930, ’maths’);
DELETE FROM course WHERE courseNumber=1;
UPDATE section SET courseNumber= WHERE courseName=’Sheaf Theory’;
Now some examples that (attempt to) violate these kinds of constraints. This gives us a chance to
look at a new example database
Now some examples that (attempt to) violate these kinds of constraints. This gives us a chance to
look at a new example database see some more SQL