cmpt 258 database systems the relationship model partii (chapter 3)

47
CMPT 258 Database Systems The Relationship Model PartII (Chapter 3)

Upload: joan-lyons

Post on 17-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

CMPT 420 Algorithms

CMPT 258 Database SystemsThe Relationship Model PartII (Chapter 3)

AnnouncementsHomework 2 is outDue on Tuesday Oct 13First midterm examThursday Oct 15Review session on Tuesday Oct 13Cheat sheet (one side of an A4 paper)

Review: SQLData Definition Language (DDL) statements are used to define the database structure or schema. Some examples:CREATE - to create objects in the databaseALTER - alters the structure of the databaseDROP - delete objects from the database

3Review: SQLData Manipulation Language (DML) statements are used for managing data within schema objects. Some examples:SELECT - retrieve data from the a databaseINSERT - insert data into a tableUPDATE - updates existing data within a tableDELETE - deletes all records from a table, the space for the records remain

4ViewsA view is a table whose rows are not explicitly stored in the database but are computed as needed from a view definitionA view is a relation. We store a definition, rather than a set of tuples.CREATE VIEW YoungActiveStudents (name, grade)AS SELECT S.name, E.gradeFROM Students S, Enrolled EWHERE S.sid = E.sid and S.age