All Collections
Courses
SQL
SQL lessons: best practices
SQL lessons: best practices

Learn effective ways of teaching SQL content in your course.

Amy Peterson avatar
Written by Amy Peterson
Updated over a week ago

1. Connect the queries in your slides to real-world questions.

Wherever possible, connect and convey your individual learning objectives to real-world questions. Teaching students how to answer real-world questions, break them down into steps within a SQL query, and translate them into a result set will generate the most value in your course.

2. Walk through queries on your slides.

Just as with Python and R instructors, we require SQL instructors to break down the code/syntax presented to students on the screen. Queries become very long, very quickly, so we ask that you specifically do the following when presenting code on slides:

  • Exclude all extraneous information where possible. For example, if you’re teaching students how to write a CASE statement, select as few columns as possible to generate a meaningful result set, limit/remove joins, etc.

  • Tell students where to focus within your query.

  • If introducing a function/statement with multiple parameters, show it to students on its own before introducing it to them in the context of another query. For example, in SQL server, the SUBSTRING() function takes three arguments -- the column/text, the starting place, and the ending place. Introduce it to students on its own, and then incorporate it in a query in the following slide.

3. Communicate the platform limitations of your approach/learning objectives

Are you teaching a function that’s only available in PostgreSQL? If your course has the title “SQL” rather than “PostgreSQL,” your course is assumed to be language neutral. Therefore, if you are introducing a concept, approach, syntax, or function only available in specific platforms, let your students know! You want your students to know where they can expect your syntax to work exactly as presented versus where they may generate errors due to platform differences. Examples:

  • Window functions are not available in SQLite

  • A lot of date, string, and numerical manipulation functions, as well as NULL values, differ between platforms (PostgreSQL, Oracle, SQL Server)

Did this answer your question?