Snippets of SQL demonstrating a number of simulated scenarios for data access, join, and aggregation, both through SQL servers and R.
- Aggregation: Join, count, filter following grouping
- Avoid Subselection: Best practice in a certain scenario
- CASE WHEN: Aggregation on cases
- IFNULL: Treating NULL as zero
- PostgreSQL: Basic queries
- SQL in R: Calling SQL from R; substring query
- UNION ALL: Appending a row of total count