Skip to content

Instantly share code, notes, and snippets.

@ml3z
Forked from nguyenhaison183/NY_restaurant.txt
Created September 20, 2021 00:13
Show Gist options
  • Save ml3z/82a9ae63c01ac4bb3c2c979365fffd89 to your computer and use it in GitHub Desktop.
Save ml3z/82a9ae63c01ac4bb3c2c979365fffd89 to your computer and use it in GitHub Desktop.
Project: New York restaurant | Codecademy | Analyze data with SQL | 2. Writing Basic Queries | Queries
SELECT *
FROM nomnom;
SELECT DISTINCT neighborhood
FROM nomnom;
SELECT DISTINCT cuisine
FROM nomnom;
SELECT *
FROM nomnom
WHERE cuisine = 'Chinese';
SELECT *
FROM nomnom
WHERE review >= 4;
SELECT *
FROM nomnom
WHERE cuisine = 'Italian'
AND price = '$$$';
SELECT *
FROM nomnom
WHERE name like '%meatball%';
SELECT *
FROM nomnom
WHERE neighborhood IN ('Midtown', 'Downtown', 'Chinatown');
SELECT *
FROM nomnom
WHERE health IS NULL;
SELECT *
FROM nomnom
ORDER BY review DESC
LIMIT 10;
SELECT name,
CASE
WHEN review > 4.5 THEN 'Extraordinary'
WHEN review > 4 THEN 'Excellent'
WHEN review > 3 THEN 'Good'
WHEN review > 2 THEN 'Fair'
ELSE 'Poor'
END AS 'Review'
FROM nomnom;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment