-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.py
30 lines (25 loc) · 1.07 KB
/
insert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import mysql.connector
conn=mysql.connector.connect(
host='localhost',
database='ums',
user='root',
password='deepthi@2000'
)
cur=conn.cursor()
class insert:
def deptinsert(x,deptid,deptname):
cur.execute(f"insert into department values({deptid},'{deptname}')")
conn.commit()
print("Data has been inserted successfully")
def courseinsert(x,courseid,coursename,coursefee,duration):
cur.execute(f"insert into course values({courseid},'{coursename}',{coursefee},{duration})")
conn.commit()
print("Data has been inserted successfully")
def facultyinsert(x,facultyid,facultyname,deptid,salary,courseid):
cur.execute(f"insert into faculty values({facultyid},'{facultyname}',{deptid},{salary},{courseid})")
conn.commit()
print("Data has been inserted successfully")
def studentinsert(x,sid,sname,courseid,departmentid):
cur.execute(f"insert into student values({sid},'{sname}',{courseid},{departmentid})")
conn.commit()
print("Data has been inserted successfully")