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

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


DELETE ऑपरेशन तब आवश्यक होता है जब आप अपने डेटाबेस से कुछ रिकॉर्ड हटाना चाहते हैं। EMPLOYEE से उन सभी रिकॉर्ड्स को हटाने की प्रक्रिया निम्नलिखित है जहां AGE 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. পাইথন ইউনিকোড ডেটাবেস (unicodedata মডিউল)

  2. পাইথন সেট অপারেশন: পূর্ণ নির্দেশিকা

  3. পাইথনে <> অপারেশনের আচরণ কী?

  4. পাইথনে ফাইল ডিলিট করার পদ্ধতি