Learn to Program 19 Python SQLite Tutorial

Code & Transcript :

SQLite Tutorial :

Interactive Tutorial :

Best Python Book :

Support me on Patreon :

In this part of my Learn to Program series I will show how to use SQLite with Python. We’ll cover connect(), cursor(), execute(), commit(), rollback(), fetchall(), fetchone(), Select, Data Types, Create, Insert, Update, Delete, Alter, Backing up the Database and more.

If you missed any of the previous videos, the series starts here :

Thank you to Patreon supports like the following for helping me make this video







27 responses to “Learn to Program 19 Python SQLite Tutorial”

  1. armin oldboy Avatar

    hi derek, i have a question .i use method rollback() for databace which i created but when i reconnect that my last order before rollback didnt delete.

  2. Eugene Fang Avatar

    How is it after you have rollback or restored the deleted data, that no. of rows still come back as 0?

  3. Balla Baby Avatar

    I have the exact same code as you at the 6 minute mark for the first example but when I run my code it's printing out the print statement for the except part. The operational error. Not sure why

  4. The Non Weaboo Avatar

    Will this work on the community edition? Because when I copy and pasted your code in, I got
    Database Created
    Table couldn't be Created
    Employee Entered
    ID : 1
    FName : Derek
    LName : Banas

  5. Nivetha Lakshmikanth Avatar

    Great videos!! Thank you very much for all the videos. Can you please explain how to do data analysis using Python?

  6. Omuro makori Avatar

    Good videos all the time Derek. Will you mind to create videos on how to use mongodb?

  7. Mussa Charles Avatar

    +Derek Banas Thanks a lot for the tutorials 🙂 I followed the link you gave for sqlite3 tutorials finished that video but there are other 3 more videos on your sqlite3 playlist ,do I need to study java first so that I can proceed to the other videos on your sqlite3 playlist?

  8. Angelbytes Web design and Computer Repair Avatar

    How do you add more than one employee in that list?

  9. Theo Valentino Avatar

    How can I search for a row that contains a cell with a sub-string that I am queryign from a pythonic variable? I would appreciate any tips!

    – – – -This does not seem to work – – – –
    c.execute("SELECT authors, year, title, abstract FROM usertable WHERE authors LIKE ?",(var1,))
    …and the variable is: var1="Smith"
    ….and in the usertable there are some of the rows with cells like this one: [Watson JU, Smith JH]

  10. kvba4444 Avatar

    Hi Derek, can you tell me where is the best place to put the code that creates (instantiates?) tables? In the constructor of my custom class, for example? I dont want the tables to be created every time i run my code, that doesnt make sense 🙂

    Nevermind, I have tackled the problem placing the code in the constructor of my DBTools class and changed the query to 'CREATE TABLE IF NOT EXISTS' Thanks for all the tutorials!

  11. praneta mahawar Avatar

    what do you mean by nameTuple[1] in "rowNames = nameTuple[1] for nameTuple in theCursor.fetchall"

  12. praneta mahawar Avatar

    Is this the correct full form and definition for blob :
    A Binary Large OBject (BLOB) is a collection of binary data stored as a single entity in a database management system. Blobs are typically images, audio or other multimedia objects, though sometimes binary executable code is stored as a blob. Database support for blobs is not universal.

  13. Peter Petrica Avatar

    Hey, I'm getting an error when running the program even when I just copied and pasted the transcript saying:
    db_conn.execute("INSERT INTO Employees (FName, LName, Age, Address, Salary, HireDate)"
    sqlite3.OperationalError: table Employees has no column named Address
    Could someone help?

  14. Matthew Avatar

    At this point, are you making these videos with a sort of curriculum in mind, or are you just jumping around in topics?

  15. Itachi Uchiha Avatar

    Hey Derek, after saving our database to .sql file,
    How can I use it to get my data back into my database?
    I hope you get what I'm asking.

  16. Kyle Seraphim Avatar

    REALLY GREAT JOB….please make more! I am super hungry , although there is a lot i don't understand sometimes, it is interesting,and therefore, motivating..

  17. MrTravelerX Avatar

    Hi Derek

    Are planning on creating a video of how to do Image Processing with Python?

  18. Cuong Bang Avatar

    It seems that there's a glitch at 17:16, the Total Rows should be 1 as you already rollback the delete :).

  19. Light Zheng Avatar

    Good tute Derek. How about do a series data analysis using python

  20. Rutwik Borole Avatar

    Thanks a lot Derek!!! Really love your videos… Is it possible for you to do on PL/SQL.. Including all those exception, trigger, procedure and cursor!!!

  21. Suzaku Kururugi Avatar

    Hey Derek,
    sorry for bothering you
    i have an university project with prolog
    i was wandering if you could help me with some advices
    The project is about finding a suitable sea resort for you to go on vacation.
    can u pls give me some advices?

  22. adasjot Avatar

    Great content. Can't wait for one on GUI!
    Also, any Dream Theater fans here? You sound so much like Jordan Rudess, their keyboardist! Just a few tutorials more and I bet I'll start thinking it's the other way around. 🙂

  23. Kristina Alderin Avatar

    Your tutorials are awesome!

    I would like to know if you could make a tutorial that is specifically directed towards finance. For example coding trading programs and other finance and investment related things. If you cannot do this could you please refer me to someone or to some other tutorial where I can find these things?


    Sir great video … will you make any video of Python with Selenium if possible …

  25. Pandora's Box Avatar

    Derek, what do you think about a graphics programming tutorial?

  26. Praveen Kumar Avatar

    how about read a CSV into the DB, and more real world examples,.. great episode.. thanks

  27. Nolan D Avatar

    What is your schedule? Two tutorials a week?

Leave a Reply

Your email address will not be published. Required fields are marked *