Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,6 @@ SQL RULES:
|
|
| 27 |
- Use ONLY table and column names that appear in the schema — never invent names.
|
| 28 |
- Use DuckDB syntax exclusively. Never use SQLite or MySQL syntax.
|
| 29 |
- Text matching: always use ILIKE '%term%'. Never use LOWER() or UPPER() for comparison.
|
| 30 |
-
- For SELECT queries, default to LIMIT 100 unless the user asks for all rows or a specific count.
|
| 31 |
- Prefer the fewest JOINs and subqueries needed to answer the question.
|
| 32 |
- Never use SELECT * — always name the columns you need.
|
| 33 |
- Age filters: use a numeric comparison on the age column directly (e.g. age > 50).
|
|
@@ -47,7 +46,7 @@ Q: How many patients above 50 have asthma?
|
|
| 47 |
A: SELECT COUNT(*) AS num_patients FROM patients WHERE age > 50 AND diagnosis ILIKE '%asthma%';
|
| 48 |
|
| 49 |
Q: Show me all patients who died during their hospital stay.
|
| 50 |
-
A: SELECT patient_id, age, gender, diagnosis FROM patients WHERE died = true
|
| 51 |
|
| 52 |
Q: What is the average age of female patients?
|
| 53 |
A: SELECT AVG(age) AS avg_age FROM patients WHERE gender ILIKE '%female%';
|
|
|
|
| 27 |
- Use ONLY table and column names that appear in the schema — never invent names.
|
| 28 |
- Use DuckDB syntax exclusively. Never use SQLite or MySQL syntax.
|
| 29 |
- Text matching: always use ILIKE '%term%'. Never use LOWER() or UPPER() for comparison.
|
|
|
|
| 30 |
- Prefer the fewest JOINs and subqueries needed to answer the question.
|
| 31 |
- Never use SELECT * — always name the columns you need.
|
| 32 |
- Age filters: use a numeric comparison on the age column directly (e.g. age > 50).
|
|
|
|
| 46 |
A: SELECT COUNT(*) AS num_patients FROM patients WHERE age > 50 AND diagnosis ILIKE '%asthma%';
|
| 47 |
|
| 48 |
Q: Show me all patients who died during their hospital stay.
|
| 49 |
+
A: SELECT patient_id, age, gender, diagnosis FROM patients WHERE died = true;
|
| 50 |
|
| 51 |
Q: What is the average age of female patients?
|
| 52 |
A: SELECT AVG(age) AS avg_age FROM patients WHERE gender ILIKE '%female%';
|