4.2 KiB
Displaying airport data
You have been provided a database built on SQLite which contains information about airports. The schema is shown below. You will use the SQLite extension in Visual Studio Code to display information about airports in various cities.
Instructions
To begin the assignment, you'll need to complete a few steps. This involves installing some tools and downloading the sample database.
Set up your system
You can use Visual Studio Code and the SQLite extension to interact with the database.
- Go to code.visualstudio.com and follow the instructions to install Visual Studio Code.
- Install the SQLite extension as described on the Marketplace page.
Download and open the database
Next, download and open the database.
- Download the database file from GitHub and save it to a folder.
- Open Visual Studio Code.
- Open the database in the SQLite extension by pressing Ctrl-Shift-P (or Cmd-Shift-P on a Mac) and typing
SQLite: Open database
. - Select Choose database from file and open the airports.db file you downloaded earlier.
- After opening the database (you won't see any visible changes on the screen), create a new query window by pressing Ctrl-Shift-P (or Cmd-Shift-P on a Mac) and typing
SQLite: New query
.
Once the query window is open, you can use it to execute SQL statements against the database. Use the command Ctrl-Shift-Q (or Cmd-Shift-Q on a Mac) to run queries on the database.
[!NOTE] For more details about the SQLite extension, refer to the documentation.
Database schema
A database's schema defines its table design and structure. The airports database contains two tables: cities
, which lists cities in the United Kingdom and Ireland, and airports
, which lists all airports. Since some cities may have multiple airports, two separate tables were created to store this information. In this exercise, you will use joins to display data for various cities.
Cities |
---|
id (PK, integer) |
city (text) |
country (text) |
Airports |
---|
id (PK, integer) |
name (text) |
code (text) |
city_id (FK to id in Cities) |
Assignment
Write queries to retrieve the following information:
- All city names in the
Cities
table. - All cities in Ireland from the
Cities
table. - All airport names along with their city and country.
- All airports located in London, United Kingdom.
Rubric
Exemplary | Adequate | Needs Improvement |
---|
Disclaimer:
This document has been translated using the AI translation service Co-op Translator. While we strive for accuracy, please note that automated translations may contain errors or inaccuracies. The original document in its native language should be regarded as the authoritative source. For critical information, professional human translation is recommended. We are not responsible for any misunderstandings or misinterpretations resulting from the use of this translation.