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

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024
  • In this Python SQLite tutorial, we will be going over a complete introduction to the sqlite3 built-in module within Python. SQLite allows us to quickly get up and running with databases, without spinning up larger databases like MySQL or Postgres. We will be creating a database, creating a table, insert, select, update, and delete data. Let's get started...
    The code from this video can be found at:
    github.com/Cor...
    ✅ Support My Channel Through Patreon:
    / coreyms
    ✅ Become a Channel Member:
    / @coreyms
    ✅ One-Time Contribution Through PayPal:
    goo.gl/649HFY
    ✅ Cryptocurrency Donations:
    Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
    Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
    Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
    ✅ Corey's Public Amazon Wishlist
    a.co/inIyro1
    ✅ Equipment I Use and Books I Recommend:
    www.amazon.com...
    ▶️ You Can Find Me On:
    My Website - coreyms.com/
    My Second Channel - / coreymschafer
    Facebook - / coreymschafer
    Twitter - / coreymschafer
    Instagram - / coreymschafer
    #Python

Комментарии • 571

  • @davorm4634
    @davorm4634 7 лет назад +580

    A Nobel prize for Python education!

  • @tictoktrending7184
    @tictoktrending7184 4 года назад +63

    The Award of "Best sqlite tutorial on RUclips " goes to Corey Schafer 👏👏👏

  • @JMEPatterson
    @JMEPatterson 5 лет назад +196

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

  • @1cannon3
    @1cannon3 5 лет назад +492

    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 лет назад +13

      god bless you and you family this video is very long

    • @haroldinho4439
      @haroldinho4439 5 лет назад +6

      So superheroes do exist !!! ^^^

    • @sahajanrajan3136
      @sahajanrajan3136 4 года назад +2

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

    • @MrMitror
      @MrMitror 4 года назад +2

      Thanks man

    • @VetsFleetNY
      @VetsFleetNY 4 года назад +2

      You're the best jacob

  • @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.

  • @khan5195
    @khan5195 Год назад +9

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

  • @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!

  • @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 3 года назад +5

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

  • @IyamwhoIyam
    @IyamwhoIyam 7 лет назад +69

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

  • @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.

  • @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.

  • @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 Год назад +3

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

  • @drakZes
    @drakZes 6 лет назад +2

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

  • @aarongrant1184
    @aarongrant1184 2 года назад +1

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

  • @omerfarukmerey
    @omerfarukmerey 3 года назад

    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!

  • @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 2 года назад +1

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

  • @chiragpalan9780
    @chiragpalan9780 3 года назад +1

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

  • @mayankinani2158
    @mayankinani2158 4 года назад +3

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

  • @PedroHenrique-no1sr
    @PedroHenrique-no1sr 2 года назад +1

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

  • @zeinelmokhtar4105
    @zeinelmokhtar4105 5 лет назад +3

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

  • @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

  • @ahmedl8574
    @ahmedl8574 3 года назад

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

  • @abigailmacdonald3698
    @abigailmacdonald3698 5 лет назад +2

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

  • @ethanbautista6344
    @ethanbautista6344 Год назад

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

  • @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!

  • @VictorMongi
    @VictorMongi 7 лет назад +24

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

  • @allansifuna8844
    @allansifuna8844 5 лет назад +2

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

    • @adityapaithon6499
      @adityapaithon6499 5 лет назад

      Checkout my channel too for some cool Python tutorials

  • @oleggaidukov4927
    @oleggaidukov4927 5 лет назад +3

    you are the God from pedagogical IT universe, man

  • @tntcaptain9
    @tntcaptain9 4 года назад +3

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

  • @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!

  • @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

  • @elliotwilens4859
    @elliotwilens4859 4 года назад

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

  • @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!

  • @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.

  • @khaled-dz8357
    @khaled-dz8357 Месяц назад +1

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

  • @PavelSTL
    @PavelSTL 3 года назад

    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.

  • @-sahlamahla2270
    @-sahlamahla2270 6 лет назад +18

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

  • @vishalraj3762
    @vishalraj3762 4 года назад +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.

  • @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

  • @al-ie4wv
    @al-ie4wv 4 года назад +7

    Corey my king getting me through school

  • @Keval_ek_insaan
    @Keval_ek_insaan 5 лет назад +5

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

  • @vitisanity
    @vitisanity 5 лет назад +8

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

  • @KleinmeisterPang
    @KleinmeisterPang 7 лет назад

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

  • @davidthompson3876
    @davidthompson3876 3 года назад

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

  • @ibrahimal-mahfooz8737
    @ibrahimal-mahfooz8737 4 года назад +1

    Wallahi you are the best teacher ever!

  • @sairajdas6692
    @sairajdas6692 6 лет назад +8

    God gifted teaching skills . Wow thank you .

  • @adamsykes3792
    @adamsykes3792 4 года назад

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

  • @gatuaprof5396
    @gatuaprof5396 3 года назад

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

  • @giahmed82
    @giahmed82 4 года назад +1

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

  • @jerwinsamuel
    @jerwinsamuel 5 лет назад +3

    Clear choice of words. Your teaching skills are amazing.

  • @shanerigsby9030
    @shanerigsby9030 6 лет назад +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.

  • @张乐-f4h
    @张乐-f4h 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.

  • @OrientalMelodies2010
    @OrientalMelodies2010 5 лет назад +1

    Your way of explaining the subject is outstanding!

  • @cd1168
    @cd1168 4 года назад +1

    Excellent. The functions really made it worth while.

  • @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.

  • @yunakamura
    @yunakamura 3 года назад +1

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

  • @miar190691
    @miar190691 3 года назад

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

  • @Yasharvl
    @Yasharvl 4 года назад

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

  • @timo_b3
    @timo_b3 3 года назад

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

  • @jjatuljain
    @jjatuljain 2 года назад

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

  • @wintats5650
    @wintats5650 4 года назад

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

  • @iamakifislam
    @iamakifislam 3 года назад

    🖤 You are the best teacher of Python

  • @anuragkadam7935
    @anuragkadam7935 9 месяцев назад

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

  • @aldehc99
    @aldehc99 2 года назад +1

    Totally fascinating learning video to watch.

  • @sameerk12982
    @sameerk12982 6 лет назад +3

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

  • @joelmontesdeoca6572
    @joelmontesdeoca6572 5 лет назад +1

    Wonderful video, sent 10 BATS. Will check out SQLAlchemy now.

    • @coreyms
      @coreyms  5 лет назад

      Thanks!

    • @joelmontesdeoca6572
      @joelmontesdeoca6572 2 года назад

      @@coreyms Those 10 BATS that had a value of about $2.40 are valued to like 7 bucks today. lol Hope you still have them! (reviewing the video again)

  • @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 5 лет назад +2

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

  • @youcefyahiaoui1465
    @youcefyahiaoui1465 5 лет назад +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!

  • @amirilifee
    @amirilifee 4 года назад +1

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

  • @nilupulperera
    @nilupulperera 4 года назад

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

  • @johnchessant3012
    @johnchessant3012 2 года назад +1

    Glad I found this, it was extremely helpful and clear

  • @trying2understand870
    @trying2understand870 5 лет назад +1

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

  • @HandledToaster2
    @HandledToaster2 3 года назад

    Thank you so much. You may very well have landed me a job!

  • @kamranmoazzamansari7289
    @kamranmoazzamansari7289 5 лет назад +1

    Breaks down things. Finally found a great video.

  • @iansharp1171
    @iansharp1171 5 лет назад +1

    You are a gifted teacher. thankyou.

  • @_jdfx
    @_jdfx 5 лет назад +1

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

  • @Zero-lb1zm
    @Zero-lb1zm 4 года назад +1

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

  • @profreed
    @profreed 3 года назад

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

  • @sessdu
    @sessdu 4 года назад +1

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

  • @BlackBlingGirl
    @BlackBlingGirl 3 года назад

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

  • @789sunshine
    @789sunshine 2 года назад +1

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

  • @dLantee
    @dLantee 10 месяцев назад

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

  • @sergei4517
    @sergei4517 4 года назад +1

    thank you for this video. Very clear!

  • @skanda5206
    @skanda5206 3 года назад

    Great explanation. He goes through everything in detail

  • @daveland2653
    @daveland2653 3 года назад

    Loved the special effects.

  • @ClariNerd
    @ClariNerd 4 месяца назад

    This is everyone's reminder that SQLite is the most-used sql database in the world, and it's not even close.

  • @suyash.01
    @suyash.01 3 года назад

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

  • @MeiaOficina
    @MeiaOficina 2 года назад

    Hey Corey. These stuff never get old, eh? Just wondering when you're getting back. Miss you man.

  • @ishpeace4886
    @ishpeace4886 5 лет назад +2

    Amazing tutorial. Thank you so much Corey

  • @ninjaboyjames
    @ninjaboyjames 2 года назад

    Bro you are carrying my computer science class

  • @Harshhification
    @Harshhification 4 года назад +1

    Wow, such a detailed explanation! Subscribed!!

  • @simoncollins7257
    @simoncollins7257 6 лет назад +2

    Fantastic video - really straight forward and informative

  • @koodauskanava9096
    @koodauskanava9096 7 лет назад +4

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