This lab will teach you the basics SQL Select queries.

Lab Slides
**

**SQL Reference Sheet

Lab 3 Activities

Lab3 Practice: Select Basics: Demo of basic select queries

  • Activity 1/2: not graded

Lab3: Advanced Selections: More advanced queries with grouping and joins

  • Activity 3: done in your table/online group, DUE

HW3: SQL Selection: Homework on advanced queries with grouping and joins

  • Individual HW: DUE

SQLite Instructions

For this lab, you must install the SQLite extension in VSCode:

image

While the extension page addresses how to use this extension, we’ll go over some key features that we will be using. That being said, we recommend reading this over to familiarize yourself with understanding developer pages.

Selecting a database

To select a database, you’ll want to type >sqlite: Open Database in the top search bar of VSCode.

When this is done, you’ll be able to view a new menu towards the bottom left of your editor:

image

Running a query

Now that the extension is installed and a database is selected, you can run your .sql files. To do this, make sure the file you would like to run is open and selected. Then, you can choose to run the >sqlite: Run Query command in the top search bar:

image

Or you can simply right click in the window, and choose Run Query:

image

Once the query is run, a panel should open up to display the output of the query. Take for example this query I ran for the Select Basics lab:

image

Notes

Make sure that when you are running queries that you are in the correct database. Otherwise, you may see incorrect results pop up.