Python SQLite Tutorial: Complete Overview - Creating a Database, Table, and Running Queries

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 575

  • @davorm4634
    @davorm4634 7 ปีที่แล้ว +594

    A Nobel prize for Python education!

  • @tictoktrending7184
    @tictoktrending7184 4 ปีที่แล้ว +66

    The Award of "Best sqlite tutorial on TH-cam " goes to Corey Schafer 👏👏👏

  • @1cannon3
    @1cannon3 5 ปีที่แล้ว +499

    1:00 - Start of video
    1:38 - SQLite tutorial begins
    1:45 - Overview of the application to build
    2:10 - You need to create a "connection" variable to represent database
    2:22 - How and where to store your database
    2:38 - Using a filename to store your database
    3:47 - Creating a cursor (This allows you to execute sql commands)
    4:10 - Creating our table and the .execute() method
    4:15 - Creating the Employee table
    6:37 - Committing db changes and closing db connection
    7:45 - How to add data to db
    8:12 - INSERT INTO VALUES() command
    8:45 - Query db for the employee we just added
    8:50 - Select statement
    8:50 - SELECT * FROM employees WHERE LAST='Shafer'
    9:35 - .fetchone(), .fetchmany(), .fetchall()
    11:12 - Adding another employee to the db and querying employee table
    12:19 - Start using the Employee class
    14:20 - Adding Python Employee() objects to db
    15:55 - Correct way to add Python objects to db
    16:01 - Option 1 (db API placeholder via ?)
    17:03 - Option 2 (db API placeholder via dictionary keys and values)
    22:57 - Prototyping CRUD functions
    23:42 - Insert employee function
    25:11 - Get employee
    26:03 - Update pay function and delete employee function

    • @YourLocalSoftwareEng
      @YourLocalSoftwareEng 5 ปีที่แล้ว +14

      god bless you and you family this video is very long

    • @haroldinho4439
      @haroldinho4439 5 ปีที่แล้ว +7

      So superheroes do exist !!! ^^^

    • @sahajanrajan3136
      @sahajanrajan3136 5 ปีที่แล้ว +2

      thank you so much dear for your kindness!!god bless you!!!

    • @MrMitror
      @MrMitror 5 ปีที่แล้ว +2

      Thanks man

    • @VetsFleetNY
      @VetsFleetNY 4 ปีที่แล้ว +2

      You're the best jacob

  • @JMEPatterson
    @JMEPatterson 5 ปีที่แล้ว +199

    You had me at "SQLite is actually part of the standard library"!

  • @michaelfresco2769
    @michaelfresco2769 7 ปีที่แล้ว +43

    You really cannot ask for a better tutorial than this. Absolutely fantastic. I like it how Corey pickups up the pace a bit at the end, and also gives us some practical functions, which show you how you'd use this in real life.

  • @scienceblossom6197
    @scienceblossom6197 4 ปีที่แล้ว +24

    This is a 28 minute video in which every minute (or every second in 28:43 to be more precise) has been used on amazing non-BS stuff. Thank you Corey your teaching levels are outstandingly higher than everyone else I've learned something from!

  • @khan5195
    @khan5195 2 ปีที่แล้ว +10

    That was exactly any newbie Pythonian could ask ! I feel like I have completed my whole uni semester in 29 minutes. Thanks mate !

  • @5starkarma
    @5starkarma 6 ปีที่แล้ว +21

    I am usually shocked if the best Python tutorials on, well, anything, can't be found on your page. You are an amazing teacher with great talent. Thank you for all your work.

  • @Luis_Fernando_Pouliot_Madero
    @Luis_Fernando_Pouliot_Madero 4 ปีที่แล้ว +5

    You teach so many things in only 29 minutes, so clear. Voice, image, sound, simplicity, direct to matter. Great! ☑☑☑☑☑

  • @PaoPaw098
    @PaoPaw098 5 ปีที่แล้ว +2

    My man teaching not only how to do the basic stuff but also what we can apply on a real world project (security, best practices etc.) you're the best.

  • @basetroll1627
    @basetroll1627 5 ปีที่แล้ว +6

    No book can replace your fantastic videos! For years(embarrassing) I've put all my data into huge arrays because I had horror of databases. With your video, so clear and understandable presented, I will now dive into it.

  • @IyamwhoIyam
    @IyamwhoIyam 7 ปีที่แล้ว +69

    You are very clear and your approach is spot on. Keep it up! We need you!

  • @davidschroeder2732
    @davidschroeder2732 ปีที่แล้ว +4

    Another outstanding presentation from Corey. One of the VERY BEST teachers on the internet.

  • @BeeBee--
    @BeeBee-- 4 ปีที่แล้ว +2

    I had to pause this vid midway to watch your OOP Tutorials 1 and 2. Your videos are consistently well-made that I could bounce off different tutorials and easily integrate them with the current lesson. Kudos!

  • @Unfettered_Braid
    @Unfettered_Braid 2 ปีที่แล้ว +3

    5 years later and this was still amazing! Thank you!

  • @aarongrant1184
    @aarongrant1184 3 ปีที่แล้ว +1

    DEAR COREY SCHAFER, HOW DO YOU ALWAYS ALWAYS ALWAYS SAVE MY DAY?
    thanks again!

  • @omerfarukmerey
    @omerfarukmerey 4 ปีที่แล้ว

    I am studying computer science in a crazy school where they teach you a little bit of something and give you huge homeworks. You have helped me a lot with this video. Thank you so much!

  • @drakZes
    @drakZes 7 ปีที่แล้ว +2

    I LOVE YOU, finally someone who explains their code and not only code so we can actually understand it. THANK YOU SO MUCH!

  • @paymeintrident
    @paymeintrident 2 ปีที่แล้ว

    Couldn’t understand this topic for the life of me… and you come along and speak clearly and in simple terms and it makes so much sense !

  • @justforwork5343
    @justforwork5343 3 ปีที่แล้ว +1

    omg i love this, after searching for more than 2 hours i finally found an awesome tutorial

  • @kaduflutist
    @kaduflutist 2 หลายเดือนก่อน

    An excellent video and python/sqlite3 teaching technique which when followed along you end up getting the same result as the coach's. I took it on a STEP-BY-STEP basis and it worked perfectly here. Thank you very much, Corey!

  • @chiragpalan9780
    @chiragpalan9780 3 ปีที่แล้ว +2

    Nothing can be better than learning Sqlite3 at 2.30AM without any prior knowladge of SQL !!!!!

    • @Kurende_SA
      @Kurende_SA หลายเดือนก่อน

      lol i can relate! 2:14AM

  • @ethanbautista6344
    @ethanbautista6344 ปีที่แล้ว

    You are literally better than all professors combined in my entire school. Thank you for this knowledge sir

  • @PedroHenrique-no1sr
    @PedroHenrique-no1sr 3 ปีที่แล้ว +1

    this is the best sqlite3 tutorial on youtube, the way you explain things are very clear and easy to understand. Great job

  • @ahmedl8574
    @ahmedl8574 3 ปีที่แล้ว

    Dude is a literal legend, ain't been this amazed in agesss by a tutorial

  • @devrubic
    @devrubic 4 ปีที่แล้ว +2

    One of the best tutorials ever. After a long time I wasn't confused on learning something new and wasn't also bored to leave it! AWESOME

  • @amyst815
    @amyst815 6 ปีที่แล้ว +7

    Simply one of the best Python tutorials out there, so good it forced me to put my first comment out here :) ... thank you Corey!

  • @mayankinani2158
    @mayankinani2158 4 ปีที่แล้ว +3

    Best place to find out about python modules and actually understanding them.

  • @abigailmacdonald3698
    @abigailmacdonald3698 5 ปีที่แล้ว +2

    A little floored by how informative your tutorials are. Thanks a lot!

  • @oleggaidukov4927
    @oleggaidukov4927 5 ปีที่แล้ว +3

    you are the God from pedagogical IT universe, man

  • @allansifuna8844
    @allansifuna8844 6 ปีที่แล้ว +2

    Your tutorials are incredible they have seen me grow from a noobie to advanced

    • @adityapaithon6499
      @adityapaithon6499 6 ปีที่แล้ว

      Checkout my channel too for some cool Python tutorials

  • @VictorMongi
    @VictorMongi 7 ปีที่แล้ว +24

    This tutorial is a Gem, seriously.... God Bless You Corey... keep making great stuff mannnn....

  • @imnodl
    @imnodl 4 ปีที่แล้ว +1

    Thank you so much for making my life so much easier, I had no idea you could use triple quotes to write multiple line strings without having to use '/n'. This greatly improved my code's readability. Also, thanks a bunch for all of these free tutorials, they're absolutely fantastic!

  • @vishalraj3762
    @vishalraj3762 5 ปีที่แล้ว +12

    Awesome video!! Short, concise & to the point. I never thought learning SQLite would be so much easy and fun with Python. Great Job, Corey!! Keep posting videos like this.

  • @elliotwilens4859
    @elliotwilens4859 4 ปีที่แล้ว

    Best SQLite tutorial on the internet! I've been searching for days & finally understand it. Thank you

  • @stevenmccarther5836
    @stevenmccarther5836 3 ปีที่แล้ว

    Was looking for a video to help me use SQLITE with Jupyter . I learned a lot with this video , Thanks Mr. Schafer

  • @zeinelmokhtar4105
    @zeinelmokhtar4105 5 ปีที่แล้ว +3

    While True:
    Print(" Corey Schafer, YOU ARE MAKING THE WORLD A BETTER PLACE. Thank You Very Much ")

  • @tntcaptain9
    @tntcaptain9 4 ปีที่แล้ว +3

    Loved the tutorial, especially the part where you made the functions for performing same SQL operations again and again

  • @benignexistence4558
    @benignexistence4558 2 ปีที่แล้ว

    Haven't even watched it yet but I thank you for not making it a combo tutorial with SQL. Too many tutorials have too much going on, thanks for employing the KISS method the way it should be.
    edit: posting this comment the first time it just said "returned error" how fitting

  • @Brandon-bm7hp
    @Brandon-bm7hp 7 ปีที่แล้ว +6

    I love your videos
    They do not turn into a big mess like others they get straight to the point like it should be!

  • @-sahlamahla2270
    @-sahlamahla2270 6 ปีที่แล้ว +18

    You're a hero!
    I love the way you explain things.
    Thanks a lot

  • @MobCat_
    @MobCat_ 3 ปีที่แล้ว

    19:06 I don't remember what its called but you can also use a c insert variables into things.. thing
    c.execute(f"INSERT INTO employees VALUE ('{emp_2.first}', '{emp_2.last}', '{emp_2.pay}')")
    the f before the "" is the important bit. print(f"Name: {emp_2.first}")
    Thanks for the awesome video as well.

    • @piotrmazgaj
      @piotrmazgaj 2 ปีที่แล้ว

      Nooo... we can't it was said. That this method is prone to SQL Injection attacks and won't worki in this case. Those are f-strings.

  • @KleinmeisterPang
    @KleinmeisterPang 7 ปีที่แล้ว

    Great video, I am using Python with SQLite at work and educated myself with Coreys Videos,.. thanks man :)

  • @Keval_ek_insaan
    @Keval_ek_insaan 6 ปีที่แล้ว +5

    You are amazing Teacher Corey! Your teaching skills are really appreciative. One of the best videos for python. Thanks you soo much.

  • @jerwinsamuel
    @jerwinsamuel 6 ปีที่แล้ว +3

    Clear choice of words. Your teaching skills are amazing.

  • @vitisanity
    @vitisanity 6 ปีที่แล้ว +8

    Excellent teaching skill. I understand how to mix class tuples and database at the same time. Many thanks.

    • @basetroll1627
      @basetroll1627 5 ปีที่แล้ว

      Me too, excellent explanation.

  • @PavelSTL
    @PavelSTL 4 ปีที่แล้ว

    I have access to a class conducted by Python professionals that my company paid for. I couldn't do it, I said screw it and I came here, this is so much better.

  • @sairajdas6692
    @sairajdas6692 6 ปีที่แล้ว +8

    God gifted teaching skills . Wow thank you .

  • @giahmed82
    @giahmed82 4 ปีที่แล้ว +1

    Excellent step by step explanation. Really love the way you have explained. Hoping to watch more of your videos.

  • @shanerigsby9030
    @shanerigsby9030 7 ปีที่แล้ว +2

    So glad I found this video as my first look at SQLite--perfect level of instruction. Hoping to find a bunch more from you.

  • @jjatuljain
    @jjatuljain 3 ปีที่แล้ว

    This one is one of the best tutorials I have gone through.. Thanks Corey !!

  • @rafalelele
    @rafalelele 6 ปีที่แล้ว +1

    Mr. Shafer, thank you very much for your tutorial. It's so clear and enlightening. I rewrote one of my script using SQLite to store records and query, which is more efficient than my previous approach (to store data in excel via openpyxl and search cell from the whole worksheet). Much appreciated.

  • @cd1168
    @cd1168 5 ปีที่แล้ว +1

    Excellent. The functions really made it worth while.

  • @OrientalMelodies2010
    @OrientalMelodies2010 6 ปีที่แล้ว +1

    Your way of explaining the subject is outstanding!

  • @ReasonablyRetro
    @ReasonablyRetro 2 ปีที่แล้ว

    Very helpful overview! Really helped understand the language and I knew almost nothing before. One small step forward. Thanks!

  • @agaby18
    @agaby18 2 ปีที่แล้ว

    Thank you! That's precisely what i need to understand the py approach to sqlite3.

  • @timo_b3
    @timo_b3 3 ปีที่แล้ว

    all this years and no one told me that there are serverless databases. thank you

  • @Yasharvl
    @Yasharvl 4 ปีที่แล้ว

    A super SQLite-3 jump start video! Thank you again Corey!

  • @aldehc99
    @aldehc99 2 ปีที่แล้ว +1

    Totally fascinating learning video to watch.

  • @wintats5650
    @wintats5650 4 ปีที่แล้ว

    Thank you so much Corey for taking the time to explain every detail. You are a blessing, be blessed!!

  • @ibrahimal-mahfooz8737
    @ibrahimal-mahfooz8737 4 ปีที่แล้ว +1

    Wallahi you are the best teacher ever!

  • @amirilifee
    @amirilifee 4 ปีที่แล้ว +1

    Nice video man. Dont stop doing same videos, bcoz we need them.)))

  • @khaled-dz8357
    @khaled-dz8357 5 หลายเดือนก่อน +2

    I wasreally wondering how tolearn hard SQLLITE and databases in genreal. You have broke down and make it like chees for me. Thanks Corey

  • @gatuaprof5396
    @gatuaprof5396 3 ปีที่แล้ว

    Nice work, buddy. I do not easily subscribe to channels, with the crystal clear demo, i had too.

  • @adamsykes3792
    @adamsykes3792 4 ปีที่แล้ว

    Super Easy To follow and im 13, great tutorial now i can say i can use sql lite in pychaarm

  • @JJohnny224
    @JJohnny224 3 ปีที่แล้ว

    That's a great video, I'm building a small project for my summer class and SQLite is perfect for it. Thanks!

  • @narendrar9940
    @narendrar9940 6 ปีที่แล้ว +2

    Wow! It was so precise, informative and all encompassing . I really enjoyed it. Thank you very much.

  • @sessdu
    @sessdu 5 ปีที่แล้ว +1

    I liked each of your tutorial I had watched, great works

  • @dLantee
    @dLantee ปีที่แล้ว

    Wonderful video! Very clear, easy to follow. Very good teaching!

  • @davidthompson3876
    @davidthompson3876 4 ปีที่แล้ว

    Excellent video. Just the right speed for me.
    Thanks.

  • @sameerk12982
    @sameerk12982 6 ปีที่แล้ว +3

    Thank you very much sir for creating such an informative clear video for sqlite.

  • @yunakamura
    @yunakamura 4 ปีที่แล้ว +1

    I should have reached this video before I accidentally went into thinking I should start with Mysql... Anyway, thanks a lot!!!

  • @youcefyahiaoui1465
    @youcefyahiaoui1465 6 ปีที่แล้ว +1

    Why! Super amazing teaching. I love Corey Schafer's tutorials.

  • @calebtallquist3932
    @calebtallquist3932 4 ปีที่แล้ว +1

    These videos are so well explained and VERY helpful and informative!

  • @Harshhification
    @Harshhification 4 ปีที่แล้ว +1

    Wow, such a detailed explanation! Subscribed!!

  • @Zero-lb1zm
    @Zero-lb1zm 4 ปีที่แล้ว +1

    This a really good tutorial Corey, thanks for all the workings and explainations.

  • @nilupulperera
    @nilupulperera 4 ปีที่แล้ว

    Excellent tutorial. Everything in one simple video. Thank you so much.

  • @_jdfx
    @_jdfx 5 ปีที่แล้ว +1

    amazing! such clear explanations, best every 30min video!

  • @BlackBlingGirl
    @BlackBlingGirl 3 ปีที่แล้ว

    Wooooow ! Thank you this is exactly what I needed for my new project ! Amazing Video and the explanations are on point !

  • @iamakifislam
    @iamakifislam 4 ปีที่แล้ว

    🖤 You are the best teacher of Python

  • @johnchessant3012
    @johnchessant3012 2 ปีที่แล้ว +1

    Glad I found this, it was extremely helpful and clear

  • @suyash.01
    @suyash.01 3 ปีที่แล้ว

    As always, to the point and straightforward. Thanks my man!

  • @jonathangeorge5814
    @jonathangeorge5814 3 ปีที่แล้ว

    I liked your explanation. They're clear and detailed. Well done video as a whole sir :)

  • @skanda5206
    @skanda5206 3 ปีที่แล้ว

    Great explanation. He goes through everything in detail

  • @789sunshine
    @789sunshine 2 ปีที่แล้ว +1

    Thanks a ton! Just exactly what I was looking for!

  • @zacstrick6133
    @zacstrick6133 5 ปีที่แล้ว +1

    This was a great video, very well structured with good sound and visuals.

  • @simoncollins7257
    @simoncollins7257 6 ปีที่แล้ว +2

    Fantastic video - really straight forward and informative

  • @ishpeace4886
    @ishpeace4886 6 ปีที่แล้ว +2

    Amazing tutorial. Thank you so much Corey

  • @profreed
    @profreed 3 ปีที่แล้ว

    really helpful! Thank you so much. I need a quick straightforward intro and that was great. Highly recommend!

  • @kamranmoazzamansari7289
    @kamranmoazzamansari7289 6 ปีที่แล้ว +1

    Breaks down things. Finally found a great video.

  • @trying2understand870
    @trying2understand870 6 ปีที่แล้ว +1

    Thank you so much Corey, really enjoy learning python from you. You are very good at explaining the minutia.

  • @iansharp1171
    @iansharp1171 5 ปีที่แล้ว +1

    You are a gifted teacher. thankyou.

  • @janzaibmbaloch5484
    @janzaibmbaloch5484 5 ปีที่แล้ว +1

    A very nice and hands on intro. Kudos

  • @miar190691
    @miar190691 3 ปีที่แล้ว

    awesome tutorial. I just made a few modification to add user input. thank you master :)

  • @CWW9000
    @CWW9000 4 ปีที่แล้ว

    Excellent, well-constructed tutorial, very useful for the data science project I'm working on, many thanks man, keep it up. -Ben

  • @novicetech1
    @novicetech1 6 ปีที่แล้ว +2

    Thanks Corey. Yet another awesome tutorial.

  • @KandMe1
    @KandMe1 4 ปีที่แล้ว

    This is really good. Just to say well done really enjoyed watching this.

  • @jonathanc.l.domingos202
    @jonathanc.l.domingos202 5 ปีที่แล้ว +2

    You're amazing! Got a new fan!

  • @anuragkadam7935
    @anuragkadam7935 ปีที่แล้ว

    Awesome channel, awesome work. Whatever i earn from my programming skills, i owe it to you. 🙌🏿✨

  • @koodauskanava9096
    @koodauskanava9096 7 ปีที่แล้ว +4

    Thanks a lot for this very clear tutorial. Really nice demonstration.