SQL summary - From relational algebra to SQL Selection C(R)...

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

View Full Document Right Arrow Icon
From relational algebra to SQL Selection σ C (R) SELECT * FROM R WHERE C; σ Length > 150 (Movies) SELECT * FROM Movies WHERE Length > 150; Conditions allowed in SQL: <, >, <=, >=, = (note – not = =), < > (not equals) Can also take AND and OR of conditions. In MySQL, can have condition: Attribute REGEXP ‘regular expression’. For example, SELECT * FROM Movies WHERE Title REGEXP ‘[aeou]t’; Projection π A1,…,Ak (R) SELECT A1,…,Ak FROM R; π Title,Year (Movies) SELECT Title, Year FROM Movies; Union, Intersection, Difference π Title,Year (Movies) π Title,Year (StarsIn) (SELECT Title, Year FROM Movies) UNION (SELECT Title, Year FROM StarsIn); π Title,Year (Movies) ∩ π Title,Year (StarsIn) (SELECT Title, Year FROM Movies)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Page1 / 2

SQL summary - From relational algebra to SQL Selection C(R)...

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

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