How to Create a Database and INSERT Some Data
Explore how to create a SQLite database in Python, build tables, and insert single or multiple records safely using parameterized queries to avoid SQL injection. This lesson guides you through the basic operations of database management with Python's sqlite3 module.
We'll cover the following...
We'll cover the following...
Creating a database in SQLite is really easy, but the process requires that you know a little SQL to do it. Here’s some code that will create a database to hold music albums:
First we have to import the sqlite3 module and create a connection to the database. You can pass it a file path, file name or just use use the special string “:memory:” to create the ...