Skip to content

Commit 81d29c0

Browse files
authored
Merge pull request #401 from hemacrimson/master
fix syntax errors in examples/solutions
2 parents 3b19157 + fe2bbef commit 81d29c0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tutorials/sql-intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ It is sometimes helpful to create temporary views or tables to break a large que
341341
```
342342
WITH patient_dates AS (
343343
SELECT p.subject_id, p.dob, a.hadm_id, a.admittime,
344-
(cast(a.admittime as date) - cast(p.dob as date) / 365.2 ) as age
344+
( (cast(a.admittime as date) - cast(p.dob as date)) / 365.2 ) as age
345345
FROM patients p
346346
INNER JOIN admissions a
347347
ON p.subject_id = a.subject_id
@@ -358,7 +358,7 @@ Another method is "materialised views", which create a new table on your databas
358358
DROP MATERIALIZED VIEW IF EXISTS patient_dates_view;
359359
CREATE MATERIALIZED VIEW patient_dates_view AS
360360
SELECT p.subject_id, p.dob, a.hadm_id, a.admittime,
361-
(cast(a.admittime as date) - cast(p.dob as date) / 365.2 ) as age
361+
( (cast(a.admittime as date) - cast(p.dob as date)) / 365.2 ) as age
362362
FROM patients p
363363
INNER JOIN admissions a
364364
ON p.subject_id = a.subject_id
@@ -459,7 +459,7 @@ SELECT icustay_id, max(valuenum) as HeartRate_Max
459459
FROM chartevents
460460
WHERE itemid = 211
461461
GROUP BY icustay_id
462-
HAVING max(valuenum) > 140;
462+
HAVING max(valuenum) <= 140;
463463
```
464464

465465
# Window functions

0 commit comments

Comments
 (0)