cs411-06c-sql3-new - CS411 Database Systems 06c SQL-3 DB...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS411 Database Systems 06c: SQL-3 DB Modification, Definition, Views
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Why Do We Learn This? • Our world, applications and databases change all the time!
Background image of page 2
3 Database Modification
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Database Modifications A modification command does not return a result as a query does, but it changes the database in some way. There are three kinds of modifications: 1. Insert a tuple or tuples. 2. Delete a tuple or tuples. 3. Update the value(s) of an existing tuple or tuples.
Background image of page 4
5 Insertion • To insert a single tuple: INSERT INTO <relation> VALUES ( <list of values> ); • Example: add to Likes(drinker, beer) the fact that Sally likes Bud. INSERT INTO Likes VALUES(‘Sally’, ‘Bud’);
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Specifying Attributes in INSERT We may add to the relation name a list of attributes. There are two reasons to do so: 1. We forget the standard order of attributes for the relation. 2. We don’t have values for all attributes, and we want the system to fill in missing components with NULL or a default value.
Background image of page 6
7 Example: Specifying Attributes • Another way to add the fact that Sally likes Bud to Likes(drinker, beer): INSERT INTO Likes(beer, drinker) VALUES(‘Bud’, ‘Sally’);
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Inserting Many Tuples • We may insert the entire result of a query into a relation, using the form: INSERT INTO <relation> ( <subquery> ); E.g., INSERT INTO Beers(name)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/17/2012 for the course CS 411 taught by Professor Winslett during the Fall '07 term at University of Illinois at Urbana–Champaign.

Page1 / 30

cs411-06c-sql3-new - CS411 Database Systems 06c SQL-3 DB...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online