Introduction to SQL

A course covering SQL coding queries using Microsoft SQL Management Studio. A good follow-on from our IDI intro course, and applicable in many other areas.

Fee structure

Student: $NZ325

Other: $NZ650


Daniel Fryer
Daniel Fryer

Course outline

Day 1
We start with a short introduction to database technologies, covering the basic structure of a database and the usefulness of the SQL relational database model. We dive into SQL coding, beginning with easy examples and the most useful data manipulation queries: Joining tables, using unique identifiers, selecting, projecting, aggregating, ordering data, and doing top-k searches. By the end of day 1 we will have had plenty of practice in using basic SQL queries to efficiently extract useful data sets and to export them to R, SAS, Stata, or other statistical software, but please note that there will not be any instruction in the use of these languages.

Day 2
This is a chance to apply our day-1 knowledge to the Microsoft SQL Management Studio coding environment commonly used to access the IDI. We start with a brief introduction to the IDI and the important peculiarities of this system, from both the research and database usage perspectives. We then learn some intermediate SQL: Nested queries, unioning, grouping, creating views, built-in functions and anything we have time for (including creating our own basic T-SQL stored procedures). The goal will be to practice using these queries to greatly speed up and simplify the process of extracting data from a database.

Course text

The instructor's notes will contain a wealth of tutorials, examples and take-home notes for future reference.