24.1. Working with Databases in Python

24.1.2. Check Your Understanding

Question

What is the correct code for establishing the connection to a database?

  1. con = sl.connect('database.db')
    
  2. con = sl.connection('database.db')
    
  3. con = sl.connect(database.db)
    
  4. 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?