Where are we?Relational AlgebraComplex QueriesExercisesOperations on Bags (and why we care)Where are we?Until now: Modeling databases (ODL, E/R): all about the schemaNow: Manipulating the data: queries, updates, SQLThen: looking inside - storage, query optimization Later: advanced features: constraints, triggers, recursion, objectsRelational AlgebraBasic operations: Projection Selection Union Intersection Set difference Cartesian product Join (natural join, theta join)By combining basic operations, we can express more complex queries.Complex QueriesProduct ( name, price, category, maker)Purchase (buyer, seller, store, product)Company (name, stock price, country)Person( name, phone number, city)Find phone numbers of people who bought gizmos from Fred.Find telephony products that somebody boughtExercises Product ( name, price, category, maker)Purchase (buyer, seller, store, product)Company (name, stock price, country)Person( name, phone number, city)Ex #1: Find people who bought telephony products.Ex #2: Find names of people who bought American productsEx #3: Find names of people who bought American products and did not buy French productsEx #4: Find names of people who bought American products and they live in Seattle.Ex #5: Find people who bought stuff from Joe or bought products from a company whose stock prices is more than $50.Operations on Bags (and why we care)Basic operations: Projection Selection Union Intersection Set difference Cartesian product Join (natural join, theta
View Full Document