





























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of sql select statements, including examples, operational semantics, renaming attributes, expressions in select clauses, complex conditions in where clauses, patterns, null values, three-valued logic, subqueries, the in and exists operators, the any and all operators, and aggregations. It covers various sql concepts and queries to help readers understand how to effectively use select statements.
Typology: Slides
1 / 69
This page cannot be seen from the preview
Don't miss anything!






























































Select-From-Where Statements
Subqueries Grouping and Aggregation
5
Notice SQL uses single-quotes for strings. SQL is case-insensitive, except inside strings.
SELECT * FROM Candies WHERE manf = ’Hershey’;
name manf Twizzler Hershey Kitkat Hershey AlmondJoyHershey
......
11
Now, the result has each of the attributes of Candies.
candy manf
Twizzler Hershey
Kitkat Hershey
AlmondJoyHershey
......
SELECT store, candy, price * 114 AS priceInYen FROM Sells;
SELECT consumer,’likes Kitkats’ AS whoLikesKitkats FROM Likes WHERE candy = ’Kitkat’;
consumer whoLikesKitkats
Sally likes Kitkats
Fred likes Kitkats
… …
SELECT name
FROM Consumers
WHERE phone LIKE ’%555-_ _ _ _’;