User Tools

Site Tools


development:ohdsi_code_style_for_sql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
development:ohdsi_code_style_for_sql [2018/02/19 09:05]
schuemie
development:ohdsi_code_style_for_sql [2018/02/19 09:10] (current)
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>​
  
development/ohdsi_code_style_for_sql.txt ยท Last modified: 2018/02/19 09:10 by schuemie