-
-
Notifications
You must be signed in to change notification settings - Fork 14
Applying tdd on select-only exercise #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
91e48a5
1c3d67f
93bc000
ac316d1
581bda6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| DROP TABLE IF EXISTS weather_readings; | ||
| CREATE TABLE weather_readings ( | ||
| date TEXT NOT NULL, | ||
| location TEXT NOT NULL, | ||
| temperature REAL NOT NULL, | ||
| humidity INTEGER NOT NULL | ||
| ); | ||
|
|
||
| .mode csv | ||
| .import ./data.csv weather_readings |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| "2025-10-22","Portland",53.1,72 | ||
| "2025-10-22","Seattle",56.2,66 | ||
| "2025-10-22","Boise",60.4,55 | ||
| "2025-10-23","Portland",54.6,70 | ||
| "2025-10-23","Seattle",57.8,68 | ||
| "2025-10-23","Boise",62.0,58 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT location, temperature FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT location, temperature FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- Expected to fail | ||
| SELECT 'Hello, world.' AS say_hi; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT 'Hello, world.'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings WHERE location = 'Seattle'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings WHERE location = 'Seattle'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings WHERE humidity BETWEEN 60 AND 70; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT * FROM weather_readings WHERE humidity BETWEEN 60 AND 70; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT DISTINCT location FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| SELECT DISTINCT location FROM weather_readings; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| -- Create database: | ||
| .read ./create_fixture.sql | ||
|
|
||
| .mode columns | ||
|
|
||
| -- Generate expected output | ||
| .output expected_output.txt | ||
|
|
||
| .print "All data" | ||
| .print "========" | ||
| .read intro-select-task1_exemplar.sql | ||
|
|
||
| .print "Location and temperature only" | ||
| .print "=============================" | ||
| .read intro-select-task2_exemplar.sql | ||
|
|
||
| .print "Greeting" | ||
| .print "========" | ||
| .read intro-select-task3_exemplar.sql | ||
|
|
||
| .print "Data for Seattle" | ||
| .print "================" | ||
| .read intro-select-task4_exemplar.sql | ||
|
|
||
| .print "Data with humidity constraints" | ||
| .print "==============================" | ||
| .read intro-select-task5_exemplar.sql | ||
|
|
||
| .print "Locations" | ||
| .print "=========" | ||
| .read intro-select-task6_exemplar.sql | ||
|
|
||
|
|
||
| -- Run user solutions | ||
| .output user_output.txt | ||
| .print "All data" | ||
| .print "========" | ||
| .read intro-select-task1.sql | ||
|
|
||
| .print "Location and temperature only" | ||
| .print "=============================" | ||
| .read intro-select-task2.sql | ||
|
|
||
| .print "Greeting" | ||
| .print "========" | ||
| .read intro-select-task3.sql | ||
|
|
||
| .print "Data for Seattle" | ||
| .print "================" | ||
| .read intro-select-task4.sql | ||
|
|
||
| .print "Data with humidity constraints" | ||
| .print "==============================" | ||
| .read intro-select-task5.sql | ||
|
|
||
| .print "Locations" | ||
| .print "=========" | ||
| .read intro-select-task6.sql | ||
|
|
||
|
|
||
| -- Compare expected vs actual | ||
| .shell diff expected_output.txt user_output.txt | ||
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.