কম্পিউটার টিউটোরিয়াল

পাইথনে ডাটাবেস ডিলিট অপারেশন


আপনি যখন আপনার ডাটাবেস থেকে কিছু রেকর্ড মুছে ফেলতে চান তখন ডিলিট অপারেশন প্রয়োজন। নিম্নে কর্মচারীর সমস্ত রেকর্ড মুছে ফেলার পদ্ধতি রয়েছে যেখানে বয়স 20 -

উদাহরণ

#!/usr/bin/python
import MySQLdb
# Open database connection
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )
# prepare a cursor object using cursor() method
cursor = db.cursor()
# Prepare SQL query to DELETE required records
sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20)
try:
   # Execute the SQL command
   cursor.execute(sql)
   # Commit your changes in the database
   db.commit()
except:
   # Rollback in case there is any error
   db.rollback()
# disconnect from server
db.close()

  1. পাইথন ইউনিকোড ডেটাবেস

  2. পাইথন সেট অপারেশন।

  3. পাইথনে <> অপারেশন কি?

  4. কিভাবে Python ব্যবহার করে একটি ফাইল মুছে ফেলতে হয়?