Some SQL Programs
Some SQL Programs
import mysql.connector as ms
con=ms.connect(host='localhost',user='root',passwd='Nothing$20',database='employees')
if con.is_connected()==False:
print('Error')
cur=con.cursor()
data=cur.fetchall()
print(row)
#Program to Delete and display the records from the given table in SQL
import mysql.connector as ms
con=ms.connect(host='localhost',user='root',passwd='Nothing$20',database='student')
if con.is_connected()==False:
print('Error')
cursor=con.cursor()
cursor.execute(st)
con.commit()
data=cursor.fetchall()
print(row)
#Program to Insert a record and display from the given table in SQL
import mysql.connector as ms
con=ms.connect(host='localhost',user='root',passwd='Nothing$20',database='employees')
if con.is_connected()==False:
print('Error')
cursor.execute(st)
con.commit()
data=cursor.fetchall()
print(row)
#Program to Update a record and display from the given table in SQL
import mysql.connector as ms
con=ms.connect(host='localhost',user='root',passwd='Nothing$20',database='student')
if con.is_connected()==False:
print('Error')
cursor=con.cursor()
cursor.execute(st)
con.commit()
data=cursor.fetchall()
print(row)