Cursors in sqlite3 python are objects that act as a pointer to the results of a query. They enable you to fetch, add, modify or delete data from a database. The cursor can also be used to traverse through the rows of a query result.
⭐️Course Contents ⭐️ ⌨️ (0:00:00) What Is A Database ⌨️ (0:03:39) Install Python ⌨️ (0:07:07) Install Git Bash Terminal ⌨️ (0:11:52) Connect to Database in Python ⌨️ (0:17:39) Create A Table ⌨️ (0:28:13) Insert One Record Into Table ⌨️ (0:31:25) Insert Many Records Into Table ⌨️ (0:34:41) Query and Fetchall ⌨️ (0:37:02) Format Your Results ⌨️ (0:44:39) Primary Key ⌨️ (0:47:51) Use The Where Clause ⌨️ (0:51:17) Update Records ⌨️ (0:56:42) Delete Records ⌨️ (0:58:27) Order Results ⌨️ (1:01:37) And/Or ⌨️ (1:04:57) Limiting Results ⌨️ (1:07:27) Delete (Drop) A Table And Backups ⌨️ (1:09:14) Unit 18 Our App - Show All Function ⌨️ (1:14:16) Unit 19 Our App - Add A Record Function ⌨️ (1:17:51) Unit 20 Our App - Delete a Record Function ⌨️ (1:21:23) Unit 21 Our App - Add Many Records Function ⌨️ (1:24:57) Unit 22 Our App - Where Clause Function
this is very easy to understand, good job, very few sqlite3 tutorials actually show the syntax of the sql knowledge and doesn't assume we learned the sql language beforehand, and this is one of them. Fantastic!
Thanks John, this was really helpful. Just want to note something I got hung up on; if you delete the last row in a table, that rowid will be REUSED when you add a new item to the table UNLESS you use the AUTOINCREMENT keyword. In other words, if the last rowid is 6, and you delete it (and all of that person's data)... then the last rowid is 5. But, if you add a new item, the new person's data will be added to a row that ALSO has the rowid of 6. This can cause issues when referencing data by rowid later on.
Wow, just wow. This is one superb course for beginners like myself. I followed the whole instructions and created an employees db. I reached a little far trying to incorporate nulls and blobs which caused me probs at the end. Ha. Had to drop back to the text and email demos but everything worked the first time after I corrected my typos. Ha. Thank you for a marvelous tutorial!
At 37:21 he mispronounces tuple as "toople" and then corrects himself after immediately remembering the correct pronunciation. As a non-native speaker of English from India, this brings a smile to my face. Because this is exactly what we do at times. When we learn English from textbooks, we have our pronunciation for some words, and then after watching native speakers pronounce it differently we try to remember the correct pronunciation. But still end up pronuncing it the way we first learned it in spite of knowing the correct way. The word that immediately comes to my mind that I personally mispronounce is "environment".
What kind of witch sorcery is this channel? As soon as I need to learn something for a project, a new course is released on the topic. This is insane and might be the tenth time it's happening. Keep up the good work!!!
This is an older video but i found it very helpful so thank you first off! Secondly, if any of you are using VS Code instead of sublime you will need to make sure you are physically inside of the folder through the explorer tab. Once inside select the sqlite folder then go to git bash and follow his steps from there!
Hint: the print function accepts multiple arguments where each one is separated by a space when printed. I.e. print( item[0], item[1]) will print Jon Elders to the screen.
In the delete section: Don''t convert the id to string in the app.py file instead convert it into an iterable by c.execute("DELETE FROM customers WHERE rowid = (?)", [id]) or c.execute("DELETE FROM customers WHERE rowid = (?)", (id,)) Thanks for the good video.
As far as I know, docstrings aren't the same as triple quote strings. Docstrings are indeed expressed on tripple quote strings, but it means something more specific, which is the on code documentation for classes and functions, actually working as source code comments, but the syntax accepts this particular case because it's industry standard. Edit: also, as far as I know, SQL is case INSENSITIVE, actually, but it's good practice to capitalize reserved words to distinguish it from context defined elements (names, parameters, etc).
This Course is really easy to follow and super useful for people who want to start using SQLite, but I wanted to understand 'JOIN' concept which is not explained neither mentioned here, so i guess I will look for some more content.
c.execute("INSERT INTO Customers VALUES (?,?,?)", (List)) sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 3, and there are 2 supplied. I've rewound the video like dozens of times now and watched it. Finally I noticed that I'm using execute() instead of executemany(). c.executemany("INSERT INTO Customers VALUES (?,?,?)", List) now it works.
Hello John, I worked on a program that asks the number of records to be inserted: import sqlite3 conn = sqlite3.connect('student.db') #create a cursor c = conn.cursor() vnaam = ' ' #Inserting records aant = int(input('Number of records to be inserted')) for x in range(aant): vnaam = input("First name? :") anaam = input("Surname? :") rek = input("Arithmetic score :") taal = int(input("Language score :")) studenten = [ (vnaam, anaam, rek, taal) ] c.executemany("INSERT INTO studenten VALUES (?,?,?,?)", studenten) print("Inserted") #Commando uitvoeren conn.commit() #afsluiten! conn.close() And it works :) (Thanks to your clear way of instructing us :)
Made sense to me, but that was because I already knew SQL and the SQLite command line. Might be easier to demonstrate SQLite command line and then ask what if we want to do this as part of a larger Python program? At the SQLite command line one can immediately demonstrate the newly created table with: SELECT customers *; If a student asks, why not do everything in SQL? Ask the student, "What if you want to graph the data?" SQL doesn't have matplotlib or even the tools to produce a formatted report. So, Python and SQL (SQLite) make a good team.
Hi! just a remark: contrary to what you say in the first part, SublimeText is free for evaluation but if you do read the little popup window (or the website) you have to buy a license for continuous usage, it's not a donation, it's a license.
Hello John, I followed closely your instructions in using tkinter and making a database. I changed your example a bit, in that I only ask for a first name and underneath that a number of entry boxes in which scores on some test can be filled in. Two questions: 1. How to get the results in some listbox or something like that 2. How can I send the results to a printer. This printer thing a a huge challenge for me :) Thank you for your fantastic video's !!
you can execute this query SELECT * FROM [table name] and then you can just use this method fetchall() on the cursor while assigning it to a variable and now your variable simply contains a list of tuples and each tuple contains values of each row corresponding to the column names.
It would be good to show readonly vs read+write connections to the sqlite3 database file, which comes in handy if you're creating a flask web app which will be used by multiple individuals at once.
amazing course and productive. Thanks for the wonderful lesson. I have learned so many things in one hour from you. Expecting more amazing stuff like this in the future Thanks a lot
17:44 it seems to me that databases really start making sense when they are comprised of MULTIPLE tables. I wish you would have touched this subject. Other than that : fantastic video ; it really helped.
I dont know if you would answer any questions here on this specific video, most likely not, but ill ask anyway. I was wondering if SQLite would be ok to use in production as the default database for a small project? Im building a small web app in Django as a reference/ educational site and have a database of at most 50 records. I dont have the option for users or allowing user data so the database wont grow, it will stay at 50 rows. Is this ok for SQLite as my main database for my django project or should it only be used for development and instead use MySQL/ PostgreSQL?
Ohh man...it feels so great when understand everything!! I like how you teach really smooth and understandable. Soon I will gotta buy some of your courses
Just discovered SQLite (Im already familiar with Maria/MySQL, Oracle, PostgreSQL) and im really digging it. Only one very easily portable .db file THATS IT thats the whole database. I love how little and compact and cute it is
@@KingdomCre8tive I don't need to, I'm a junior DBA i mostly deal with oracle, MySQL and postgres but in my spare time i like to experiment with other stuff and I found SQLite really neat.
1:21:03 it worked with '6' as 🐍 doesnt treat 6 as a sequence (and we need to pass a sequence for: .execute(..., here). '6' is iterable and it handled the issue
Thank you for this super helpful video! just one thing, normally you do not work with the Rowid!!! first, you have to search it! Second, you cannot delete Record with two digits in this way (like Record 10 or 15). the (?) takes only one number ('n').
Very good introductory course! Thank you for sharing, the energy end enthusiasm is contagious! Looking forward to learn slqite more in depth, but at a first glance I didn't found an advanced course on codemy..
You are amazing . Doing such a great job. I don't know how could I express my opinion to you! I don't know you believe in god or not. But I wish that god bless you. I feel like you are giving food to the poor hungry learners without asking money. Thank you again.
at 1:26:15 took me half a day to understand that little "quirk" of comma in "(email,)" and found out that it is also possible to write "[email]" as both cases returns an iterable.
I'm really scratching my head 9n passing rowid as a string, and then it "just works". Stuff like this drives me crazy. I guess it's no worse than perl and the way it used the context of what it was seeing in the code instead of following a strict syntax grammar. perl can produce incredible results, but things written in it are pretty much unmaintainable. A write-only language. ;)
@@tonyfremont I am not sure if your comment should be under mine. but It seems what you mentioned is about parameter type of sqlite's execute function. I find it interesting and tried 2 changes, one is the I mentioned in my comment: send an integer rowid, as we normally would do, into delete function use it inside as either "(id,)" or "str(id)" in execute function.
I didn't know Walter White was also skilled in programming. Cool!
I am the danger, Walter said while talking to his wife about hacking
This comment deserves more likes! 😂
Hahahahahahahaha
Maybe he is planning to hack Pentagon. This time
You'll notice that almost every skilled programmer is a bald be-speckled goatie (stubble too) wearing guy. Including myself. :)
Cursors in sqlite3 python are objects that act as a pointer to the results of a query. They enable you to fetch, add, modify or delete data from a database. The cursor can also be used to traverse through the rows of a query result.
⭐️Course Contents ⭐️
⌨️ (0:00:00) What Is A Database
⌨️ (0:03:39) Install Python
⌨️ (0:07:07) Install Git Bash Terminal
⌨️ (0:11:52) Connect to Database in Python
⌨️ (0:17:39) Create A Table
⌨️ (0:28:13) Insert One Record Into Table
⌨️ (0:31:25) Insert Many Records Into Table
⌨️ (0:34:41) Query and Fetchall
⌨️ (0:37:02) Format Your Results
⌨️ (0:44:39) Primary Key
⌨️ (0:47:51) Use The Where Clause
⌨️ (0:51:17) Update Records
⌨️ (0:56:42) Delete Records
⌨️ (0:58:27) Order Results
⌨️ (1:01:37) And/Or
⌨️ (1:04:57) Limiting Results
⌨️ (1:07:27) Delete (Drop) A Table And Backups
⌨️ (1:09:14) Unit 18 Our App - Show All Function
⌨️ (1:14:16) Unit 19 Our App - Add A Record Function
⌨️ (1:17:51) Unit 20 Our App - Delete a Record Function
⌨️ (1:21:23) Unit 21 Our App - Add Many Records Function
⌨️ (1:24:57) Unit 22 Our App - Where Clause Function
nice job copying the description
He already created a time outline of specific concepts in the video = instant upvote!
Down-to-earth explanations > boss move!
this is very easy to understand, good job, very few sqlite3 tutorials actually show the syntax of the sql knowledge and doesn't assume we learned the sql language beforehand, and this is one of them. Fantastic!
may i ask how do i move on from this tutorial into more functional sql?
@@MahdeenSky howd it go
Thanks John, this was really helpful. Just want to note something I got hung up on; if you delete the last row in a table, that rowid will be REUSED when you add a new item to the table UNLESS you use the AUTOINCREMENT keyword. In other words, if the last rowid is 6, and you delete it (and all of that person's data)... then the last rowid is 5. But, if you add a new item, the new person's data will be added to a row that ALSO has the rowid of 6. This can cause issues when referencing data by rowid later on.
Wow, just wow. This is one superb course for beginners like myself. I followed the whole instructions and created an employees db. I reached a little far trying to incorporate nulls and blobs which caused me probs at the end. Ha. Had to drop back to the text and email demos but everything worked the first time after I corrected my typos. Ha. Thank you for a marvelous tutorial!
Thank you John for this video! I watched the whole thing and it was really a well-planned lesson! This really helps me grasp the basics for sqlite3!
At 37:21 he mispronounces tuple as "toople" and then corrects himself after immediately remembering the correct pronunciation. As a non-native speaker of English from India, this brings a smile to my face. Because this is exactly what we do at times. When we learn English from textbooks, we have our pronunciation for some words, and then after watching native speakers pronounce it differently we try to remember the correct pronunciation. But still end up pronuncing it the way we first learned it in spite of knowing the correct way. The word that immediately comes to my mind that I personally mispronounce is "environment".
🤣🤣🤣
What kind of witch sorcery is this channel? As soon as I need to learn something for a project, a new course is released on the topic. This is insane and might be the tenth time it's happening.
Keep up the good work!!!
When deciding what course to post, our first thought is always "What does Aidyn Skullz need to learn right now?" 😀
@@freecodecamp haha LOL. Thanks for replying though XD.
@@freecodecamp so you guys have everything ready? why not post all of them.
Didn't know Walter white was so good at teaching sqlite! Great video!
This is an older video but i found it very helpful so thank you first off! Secondly, if any of you are using VS Code instead of sublime you will need to make sure you are physically inside of the folder through the explorer tab. Once inside select the sqlite folder then go to git bash and follow his steps from there!
Bro how to run vscode instead of sublime please give proper steps
I have finished this course...I have enjoyed every second in this course and i have learned lot of details... thankyou very much..
This is the type of channel that will mold the next Bill Gates
Few of us watching will create something revolutionary
hopefully :)
Not sure if we want another one of him though.
How is it going Bill?
What a CrashCourse man!!
AWESOME!!
Me thinking about learning python
TH-cam : I see you wanna learn python,here you go
Dragonarch youtube just knows man
bruh i recommend you to learn python before watching this video
Neuralink in action
Super and simple course which permits to understand the use of database into an application written using Python. Thank you sir
WALTER WHITE teaching me SQLITE, what a time to be alive :D
This was awesome. I was trying to figure out sqlite3. Thanks!!!
Hint: the print function accepts multiple arguments where each one is separated by a space when printed. I.e. print( item[0], item[1]) will print Jon Elders to the screen.
Hi John, I watched all clips. Thx for your full course "Sqlite databases with Python". Well done!!!
Thank you for this super helpful video! Keep up the awesome work. I've been really enjoying your courses on TH-cam. You're such an awesome instructor!
Simply loved how crisp and to the point this course was. Thank you so much!
I worked through all of the code examples. Thank you! I have learned a lot!
I saw his TKinter playlist too. Amazing teacher !
thanks alot that was such an awesome video to learn basics about sql lite with python
In the delete section:
Don''t convert the id to string in the app.py file instead convert it into an iterable by
c.execute("DELETE FROM customers WHERE rowid = (?)", [id])
or
c.execute("DELETE FROM customers WHERE rowid = (?)", (id,))
Thanks for the good video.
THANK YOU! I was wondering... great advice
great! thanks :)
As far as I know, docstrings aren't the same as triple quote strings. Docstrings are indeed expressed on tripple quote strings, but it means something more specific, which is the on code documentation for classes and functions, actually working as source code comments, but the syntax accepts this particular case because it's industry standard.
Edit: also, as far as I know, SQL is case INSENSITIVE, actually, but it's good practice to capitalize reserved words to distinguish it from context defined elements (names, parameters, etc).
Six months later but you're absolutely right
This Course is really easy to follow and super useful for people who want to start using SQLite, but I wanted to understand 'JOIN' concept which is not explained neither mentioned here, so i guess I will look for some more content.
Thanks a lot for this, seriously you are an incredible teacher.
c.execute("INSERT INTO Customers VALUES (?,?,?)", (List))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 3, and there are 2 supplied.
I've rewound the video like dozens of times now and watched it. Finally I noticed that I'm using execute() instead of executemany(). c.executemany("INSERT INTO Customers VALUES (?,?,?)", List) now it works.
You Rock I roll... Seriously, This guy's videos are most helpful in the entire TH-cam!
John hope you are eating well and are healthy. Really loved the course. Thanks for the video and keeping it simple and short.
Hello John,
I worked on a program that asks the number of records to be inserted:
import sqlite3
conn = sqlite3.connect('student.db')
#create a cursor
c = conn.cursor()
vnaam = ' '
#Inserting records
aant = int(input('Number of records to be inserted'))
for x in range(aant):
vnaam = input("First name? :")
anaam = input("Surname? :")
rek = input("Arithmetic score :")
taal = int(input("Language score :"))
studenten = [
(vnaam, anaam, rek, taal)
]
c.executemany("INSERT INTO studenten VALUES (?,?,?,?)", studenten)
print("Inserted")
#Commando uitvoeren
conn.commit()
#afsluiten!
conn.close()
And it works :) (Thanks to your clear way of instructing us :)
1:02:43 Epic bruh moment
Excelent video btw
Really easy to follow along course loved the simple explanation thankyou
Just started a new project in React-Native this SQLite course will help a lot for mobile dev. Thanks 🙏
Very simple and straight forward. Congrats!
The best video course i will enrol on 👍👍👍👍👍👍
He is enjoying himself.. he doesn't want the output to be displayed... What a gamer!!!!!
Made sense to me, but that was because I already knew SQL and the SQLite command line.
Might be easier to demonstrate SQLite command line and then ask what if we want to do this as part of a larger Python program? At the SQLite command line one can immediately demonstrate the newly created table with:
SELECT customers *;
If a student asks, why not do everything in SQL? Ask the student, "What if you want to graph the data?" SQL doesn't have matplotlib or even the tools to produce a formatted report. So, Python and SQL (SQLite) make a good team.
Hello ,I am starting to learn Data science,so I am beginer and this course it's very good for beginers,thank you very much!!!
Thank you very much on this video!
It helped me.
I'm beginner in programming.
Python is my first programming language.
Amazing course! such a big teacher and explanation method!
in spite of all unfair comments, I have to say perfect video. Thanks!!!
Massive respect for these guys
Learnt a lot from this video. The only thing I didn't get is how to reset your rowid after you have deleted something
Thanks John! Super useful! I learned a lot!!!
Hi! just a remark: contrary to what you say in the first part, SublimeText is free for evaluation but if you do read the little popup window (or the website) you have to buy a license for continuous usage, it's not a donation, it's a license.
Thank you so much for the free high quality tutorial!
AMAZING....#just got re-candled again😊
Great video mate, I learned SQL and sqlite3 from you, thanks
Really easy to understand course. Some very useful bits in there. Thanks John!
Hello John, I followed closely your instructions in using tkinter and making a database. I changed your example a bit, in that I only ask for a first name and underneath that a number of entry boxes in which scores on some test can be filled in.
Two questions:
1. How to get the results in some listbox or something like that
2. How can I send the results to a printer.
This printer thing a a huge challenge for me :)
Thank you for your fantastic video's !!
you can execute this query SELECT * FROM [table name]
and then you can just use this method fetchall() on the cursor while assigning it to a variable and now your variable simply contains a list of tuples and each tuple contains values of each row corresponding to the column names.
I appreciate your work on this tutorial. Thanks mate!
It would be good to show readonly vs read+write connections to the sqlite3 database file, which comes in handy if you're creating a flask web app which will be used by multiple individuals at once.
Thank you so much John for the lesson! Your calm natural way of teaching is great!
amazing course and productive.
Thanks for the wonderful lesson.
I have learned so many things in one hour from you.
Expecting more amazing stuff like this in the future
Thanks a lot
You are amazing and you are way of teaching is brilliant and time saving
1:29:36 if you use:
id = str(id) in the delete_one function the input will be converted to an interger
Great tutorial You really dont need a college just TH-cam is enough✌
Or maybe just the channels like freecodecamp 👍
damn true but youtube don't gives degree. hahaha
@@usamanadeem_404 with a degree if you can't do anything that is worst than not having a degree but skill
@@dearstats6100 and i am thinking what kind of the education system would be of a person if he/she got degree but don't have skills.
@@usamanadeem_404 Well If that degree is gonna cost thousands of dollars . I am better of only with the skills !
very good instructor, of course you will need to know some python before you watch this video
First helpful tutorial on this topic
i love his style of teaching: "So guys what is SQL? I don't know.....................
Better than my college professor thanks a lot ✌
Thank you for publishing this video and teaching smoothly .....very practical and useful 👌
Thank you! The author made me understand to use Python that do CRUD a database incredibly
Really appreciate everything this channel does!
Thank you for this Walter!
17:44 it seems to me that databases really start making sense when they are comprised of MULTIPLE tables.
I wish you would have touched this subject. Other than that : fantastic video ; it really helped.
I dont know if you would answer any questions here on this specific video, most likely not, but ill ask anyway. I was wondering if SQLite would be ok to use in production as the default database for a small project? Im building a small web app in Django as a reference/ educational site and have a database of at most 50 records. I dont have the option for users or allowing user data so the database wont grow, it will stay at 50 rows. Is this ok for SQLite as my main database for my django project or should it only be used for development and instead use MySQL/ PostgreSQL?
Really helpful Video
Made the bridge of knowledge which I needed from a long time
One more time thank you
Thanks to TH-cam, im gonna complete my bachelor's before end of my 2nd semester of college 😂😂✌️
Am studying in 7th grade!
@@reold cool
@@reold same here
😂😂
I was born yesterday
this is sooooo useful. thank you so much. you're an incredible teacher!
Ohh man...it feels so great when understand everything!! I like how you teach really smooth and understandable. Soon I will gotta buy some of your courses
Great hands on course, thank you John
Just discovered SQLite (Im already familiar with Maria/MySQL, Oracle, PostgreSQL) and im really digging it. Only one very easily portable .db file THATS IT thats the whole database. I love how little and compact and cute it is
You'll never get a job in it
@@KingdomCre8tive I don't need to, I'm a junior DBA i mostly deal with oracle, MySQL and postgres but in my spare time i like to experiment with other stuff and I found SQLite really neat.
Many thanks, great video!
Thank you so much for this video, it was well planned and really helped me!!!
Ah, thank you. This video cleared up a lot of things I was confused about.
1:21:03 it worked with '6' as 🐍 doesnt treat 6 as a sequence (and we need to pass a sequence for: .execute(..., here). '6' is iterable and it handled the issue
Good explanation sir Thnks a lot 😊😊😊😊
Thank you for this super helpful video! just one thing, normally you do not work with the Rowid!!! first, you have to search it! Second, you cannot delete Record with two digits in this way (like Record 10 or 15). the (?) takes only one number ('n').
9 months later but use a dictionary key instead of (?) tuple
or use ...rowid=(?)", (id,))
Very good introductory course! Thank you for sharing, the energy end enthusiasm is contagious! Looking forward to learn slqite more in depth, but at a first glance I didn't found an advanced course on codemy..
Thank you for this super helpful video!
Very Easy to Understand this one...🙏🏻
You are amazing . Doing such a great job. I don't know how could I express my opinion to you! I don't know you believe in god or not. But I wish that god bless you. I feel like you are giving food to the poor hungry learners without asking money. Thank you again.
Thx for video! I think that best way for use database functions is optional args connection, we just create one connection and use it in all functions
Thank you so much, such a good explanation 😊
Hello John,
Your course is MOST helpful. Thanks a lot. Cristal clear :)))
Excellent dude.. Very good course for beginners.
Thank you John. It was really helpful :)
This video is incredible.
You did such a great job. I loved it.
Excellent tutorial. Many thanks for the great videos.
You are a champion if you have any python course I will go for it.
Thank you for your bright knowledge.
Thanks for the brilliant guide.
Thank you for this great course...
thank you for upload this video, very educational.
at 1:26:15
took me half a day to understand that little "quirk" of comma in "(email,)"
and found out that it is also possible to write "[email]" as both cases returns an iterable.
I'm really scratching my head 9n passing rowid as a string, and then it "just works". Stuff like this drives me crazy. I guess it's no worse than perl and the way it used the context of what it was seeing in the code instead of following a strict syntax grammar. perl can produce incredible results, but things written in it are pretty much unmaintainable. A write-only language. ;)
@@tonyfremont I am not sure if your comment should be under mine. but It seems what you mentioned is about parameter type of sqlite's execute function.
I find it interesting and tried 2 changes, one is the I mentioned in my comment: send an integer rowid, as we normally would do, into delete function use it inside as either "(id,)" or "str(id)" in execute function.