





























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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-_ _ _ _’;