In this page we demonstrate how to initialize a database. There is a
lot going on there.
- Start a connection
Connection successful.
- Delete old tables. Here we want to use exec() because the drop
command does not return a queryset but instead number of rows
effected. (Note: Always returns 0 when deleting or creating
tables.)
Delete artist:
Number of rows effected: 0
Number of rows effected: 0
- Create Tables. The SQL here is the same as if you were doing it
via command line
Artist Table then Album Table
Number of rows effected: 0
Number of rows effected: 0
- Load Values Into Database
- Check Values (should be 100 albums but less artist since The
Beatles and Led Zepplin Rock.
Number of artists: 65
Number of albums: 100