Delete_Theatre() to input the value of Th_ID from the user and permanently delete the corresponding record from the THEATRE table in the CINEMA database.commit() after INSERT, UPDATE, or DELETE to save changes.cursor.rowcount to check if a record was modified or deleted.%s to avoid SQL injection.
import mysql.connector
def Delete_Theatre():
try:
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="Ex2025",
database="CINEMA"
)
mycursor = mydb.cursor()
thid = input("Enter Theatre ID to delete: ")
query = "DELETE FROM THEATRE WHERE Th_ID = %s"
mycursor.execute(query, (thid,))
mydb.commit()
if mycursor.rowcount > 0:
print("Record deleted successfully.")
else:
print("No record found with the given Theatre ID.")
mycursor.close()
mydb.close()
except mysql.connector.Error as err:
print("Error:", err)
The SELECT statement when combined with \(\_\_\_\_\_\_\) clause, returns records without repetition.
print(16 * 5 / 4 * 2 / 5 - 8)
myStr[:4] extracts the first 4 characters, which are "MISS".myStr[-5:] extracts the last 5 characters, which are "SIPPI"."#" in between, resulting in "MISS#SIPPI".In SQL, the aggregate function which will display the cardinality of the table is \(\_\_\_\_\_\).
Suman has created a table named WORKER with a set of records to maintain the data of the construction sites, which consists of WID, WNAME, WAGE, HOURS, TYPE, and SITEID. After creating the table, she entered data in it, which is as follows : 