development:ohdsi_code_style_for_sql
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| development:ohdsi_code_style_for_sql [2018/02/19 09:05] – schuemie | development:ohdsi_code_style_for_sql [2020/04/06 13:40] (current) – schuemie | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== OHDSI code style for SQL ====== | ====== OHDSI code style for SQL ====== | ||
| - | The OHDSI code style for SQL is heavily inspired by the [[http:// | + | This has moved here: https://ohdsi.github.io/MethodsLibrary/codeStyle.html# |
| - | + | ||
| - | + | ||
| - | ===== Case ===== | + | |
| - | Because several database platforms are case-insensitive and tend to convert table and field names to either uppercase (e.g. Oracle) or lowercase (e.g. PostgreSQL), | + | |
| - | + | ||
| - | **Good** | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | **Bad** | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | ===== Commas ===== | + | |
| - | Commas should be trailing. | + | |
| - | + | ||
| - | **Good** | + | |
| - | < | + | |
| - | SELECT COUNT(*) AS person_count, | + | |
| - | condition_concept_id, | + | |
| - | condition_type_concept_id | + | |
| - | FROM condition_era | + | |
| - | GROUP BY condition_concept_id, | + | |
| - | condition_type_concept_id | + | |
| - | </ | + | |
| - | + | ||
| - | **Bad** | + | |
| - | < | + | |
| - | SELECT COUNT(*) AS person_count | + | |
| - | , | + | |
| - | , | + | |
| - | FROM condition_era | + | |
| - | GROUP BY condition_concept_id | + | |
| - | , | + | |
| - | </ | + | |
development/ohdsi_code_style_for_sql.1519031130.txt.gz · Last modified: by schuemie
