Databases + Python with SQLite3

preview_player
Показать описание
This is a tutorial for newcomers to using databases with Python. We what a database is, how to create one, how to create tables, and how to insert, retrieve, edit, and delete data.
Link to Code:

Join the CS Classroom Discord for help and fun:

#python #coding #databases #sqlite

00:00 - What is a database?
01:15 - What is are tables?
04:49 - Creating a SQLite Database
05:38 - Creating a Table
08:22 - Inserting Data
12:47 - Retrieving Data
17:31 - Editing Data
21:57 - Deleting Data
Рекомендации по теме
Комментарии
Автор

Great tutorial. Here are some observation. You don't need to create a database before and place it where you are going to be executing your queries. Sqlite3 will create the database when you establish the connection if not exists. If the database does exists a connection will open it. Also, you don't want to override an existing table, I will suggest to use "CREATE TABLE IF NOT EXISTS..." this will prevent overriding a table with valuable information in it.

aavalos
Автор

Your explanation is amazing, thank you.

henrycovil
Автор

Thanks for the video. I have abandoned sqlite3 module as I found peewee - nice warpper for python sqlite3 ;)

dimioo
Автор

Every other tutorial I've seen teaches to create a cursor object and assign it to a variable, but it seems you skip this step and simply call the execute method directly from the connection object? Is there any advantage / disadvantage to either way?

tomiwan