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)
Give the output of the query: SELECT MONTH("2010-03-05");
| List-I | List-II |
|---|---|
| (A) SUBSTR() | (II) To extract a substring from a string. |
| (B) TRIM() | (IV) To remove spaces from both sides of the string. |
| (C) INSTR() | (I) To find the position of a substring in a string. |
| (D) LEFT() | (III) To extract characters from the left side of the string. |
Given the following table:
| ENO | SALARY |
|---|---|
| A101 | 4000 |
| B109 | NULL |
| C508 | 6000 |
| A305 | 2000 |
State the output of the following query:
SELECT COUNT(SALARY) FROM EMPLOYEE;
Draw a rough sketch for the curve $y = 2 + |x + 1|$. Using integration, find the area of the region bounded by the curve $y = 2 + |x + 1|$, $x = -4$, $x = 3$, and $y = 0$.