What you should learn from this project:
- Why Python programming is awesome (don’t forget to tweet today, with the hashtag #pythoniscool :))
- How to connect to a MySQL database from a Python script
- How to SELECT rows in a MySQL table from a Python script
- How to INSERT rows in a MySQL table from a Python script
- What ORM means
- How to map a Python Class to a MySQL table
- Write a script that lists all states from the database hbtn_0e_0_usa:
- Write a script that lists all states with a name starting with N (upper N) from the database hbtn_0e_0_usa:
- Write a script that takes in an argument and displays all values in the states table of hbtn_0e_0_usa where name matches the argument.
- Wait, do you remember the previous task? Did you test "Arizona'; TRUNCATE TABLE states ; SELECT * FROM states WHERE name = '" as an input?
- Write a script that lists all cities from the database hbtn_0e_4_usa
- Write a script that takes in the name of a state as an argument and lists all cities of that state, using the database hbtn_0e_4_usa
- Write a script that lists all State objects from the database hbtn_0e_6_usa
- Write a script that prints the first State object from the database hbtn_0e_6_usa
- Write a script that lists all State objects that contain the letter a from the database hbtn_0e_6_usa
- Write a script that prints the State object with the name passed as argument from the database hbtn_0e_6_usa
- Write a script that adds the State object “Louisiana” to the database hbtn_0e_6_usa
- Write a script that changes the name of a State object from the database hbtn_0e_6_usa
- Write a script that deletes all State objects with a name containing the letter a from the database hbtn_0e_6_usa
- Write a Python file similar to model_state.py named model_city.py that contains the class definition of a City.
- Geoffrey Zoref - Gzoref