DELETE record Python MySql
Database में table में record को delete करने के लिए DELETE FROM SQL स्टेटमेंट का उपयोग करना होता है।
जब भी Record DELETE करे तो where clause(condition) का उपयोग करे नहीं तो सभी record delete हो जायेंगे।
DELETE FROM employee WHERE id=1
import mysql.connector
db = mysql.connector.connect(
host="localhost", user="username", passwd="password", database="dbname"
)
crsr = = mydb.cursor()
crsr.execute("DELETE FROM employee WHERE id=1")
db.commit()
print(crsr.rowcount, "record(s) deleted")
db.close()
ENGLISH me padhne ke liye 👇👇
DELETErecord Python MySql
The DELETE FROM SQL statement has to be used to delete the records in the table in the database.
Whenever record DELETE, use all where clause (condition) or else all records will be deleted.
DELETE FROM employee WHERE id = 1
import mysql.connector db = mysql.connector.connect (host = "localhost", user = "username", passwd = "password", database = "dbname") crsr = = mydb.cursor () crsr.execute ("DELETE" FROM employee WHERE id = 1 ") db.commit () print (crsr.rowcount," record (s) deleted ") db.close ()
for more videos Comments now .... All students of Python
Ye topic kaisa lega ye bhi zaroori bataye agla video kis program ke upar chahiye ye bhi bataye
0 टिप्पणियाँ
If you have any doubt. Please let me know