Project 9: Destinations SQL Query
Data Analyst
Builds on these lessons
Current Task
Objective
pd.read_sql() runs a SQL query against a database connection and returns the results as a DataFrame.
Task: connect to travel.db, query the destinations table, and print the first rows.
index.py
import pandas as pd
import sqlite3
conn = sqlite3.connect('travel.db')
destinations = pd.read_sql('SELECT * FROM destinations', conn)
print(destinations.head())
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview