24.1. Working with Databases in Python¶
24.1.1. Reading¶
Read the following articles:
24.1.2. Check Your Understanding¶
Question
What is the correct code for establishing the connection to a database?
con = sl.connect('database.db')
con = sl.connection('database.db')
con = sl.connect(database.db)
con = pd.connect('database.db')
Question
read_sql_query()
has 2 arguments. What are they?
Question
Is it a good practice to attempt to first explore a database with a database client or pandas
? Why?
Question
Is it good practice to limit the fields and/or records to retrieve when setting up a DataFrame from a database table?
Question
Should the database server handle JOINS
or pandas
? Why?
Queston
If your connection is named con
, and you want to add a new record to the table, costco_finds
, what would your code look like?
Question
If you wanted to print the records in the costco_finds
table, what would your code look like?
Question
If you wanted to change the name of one of your costco_finds
, what would your code look like?
Question
If you wanted to remove a record from costco_finds
, what would your code look like?