This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
development:ohdsi_code_style_for_sql [2018/02/19 09:05] schuemie |
development:ohdsi_code_style_for_sql [2018/02/19 09:10] schuemie |
||
---|---|---|---|
Line 42: | Line 42: | ||
GROUP BY condition_concept_id | GROUP BY condition_concept_id | ||
,condition_type_concept_id | ,condition_type_concept_id | ||
+ | </code> | ||
+ | |||
+ | ===== Indentation and new lines ===== | ||
+ | Indentation is done using tabs. Field definitions are followed by a new line. | ||
+ | |||
+ | **Good** | ||
+ | <code> | ||
+ | SELECT COUNT(*) AS person_count, | ||
+ | condition_type_concept_id | ||
+ | FROM ( | ||
+ | SELECT * | ||
+ | FROM condition_era | ||
+ | WHERE condition_concept_id = 123 | ||
+ | ) tmp | ||
+ | GROUP BY condition_type_concept_id; | ||
+ | </code> | ||
+ | |||
+ | **Bad** | ||
+ | <code> | ||
+ | SELECT COUNT(*) AS person_count, condition_type_concept_id | ||
+ | FROM (SELECT * FROM condition_era WHERE condition_concept_id = 123) tmp | ||
+ | GROUP BY condition_type_concept_id; | ||
</code> | </code> | ||