Docsity

Relational Databases-Lecture 06 Slides-Computer Science, Slides of Relational Database Management Systems (RDBMS)

Partial preview of the text

Download Relational Databases-Lecture 06 Slides-Computer Science and more Slides Relational Database Management Systems (RDBMS) in PDF only on Docsity!

Relational Databases - Comp2400 / Comp

Lecture 8: Updates and Constraints

Changing the database, keeping it valid

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)

Feedback Summary

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

Feedback Summary

25 people want more practical exercises, examples and hands-on stuff 13 people expect the labs to help, and/or want their databases working

Feedback Summary

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

Feedback Summary

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

Feedback Summary

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)

Feedback Summary

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

Update Operations

[E&N §5.3]

A database state represents the state of the world.

Update Operations

[E&N §5.3]

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 Operations

[E&N §5.3]

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

SQL for Update Operations

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;

SQL for Update Operations

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’;

Some Examples

Now some examples that (attempt to) violate these kinds of constraints. This gives us a chance to

look at a new example database

Some Examples

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