Skip to content

Instantly share code, notes, and snippets.

@nguyenhaison183
Last active April 19, 2024 09:26
Show Gist options
  • Save nguyenhaison183/c0a9119be6b8422757de64652a6b2796 to your computer and use it in GitHub Desktop.
Save nguyenhaison183/c0a9119be6b8422757de64652a6b2796 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