If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
limit का use Database Table से limited records select करने के लिए किया जाता है।
# import connector class from mysql module.
import mysql.connector as myconn mydb = myconn.connect( host = 'localhost', user = 'root', password = '', database = 'python_db' ) db_cursor = mydb.cursor() # select only 2 records. query = "SELECT * FROM users LIMIT 2" db_cursor.execute(query) rows = db_cursor.fetchall() for row in rows : print(row)
#delete 5 records.
query = "DELETE FROM users WHERE last_name=%s LIMIT 5" value = ('Singh', ) db_cursor.execute(query, value) #update only 3 records. query = "UPDATE users SET email = %s WHERE id=%s LIMIT 3" set_value = ('changedEmail@gmail.com', 1) db_cursor.execute(query, set_value)
Hi ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.