CSC Project
CSC Project
TABLE OF CONTENTS
1 PROJECT DESCRIPTION
2 GLIMPSES OF PYTHON
3 GLIMPSES OF MYSQL
4 HARDWARE AND SOFTWARE
CONFIGURATION
5 TABLES IN THE DATABASE
6 SOURCE CODE
7 OUTPUT
8 BIBLIOGRAPHY
PROJECT DESCRIPTION
SOFTWARE
• Windows OS
• Python 3.12
• MySQL 8.0 Command Line Client
TABLES IN THE
DATABASE
SOURCE CODE
import mysql.connector as ms
mycon=ms.connect(host='localhost',user='root',p
assword='password',database='todolist')
mycursor=mycon.cursor()
def display():
global mycon,mycursor
try:
inpstrquery="select * from useractivity"
mycursor.execute(inpstrquery)
results=mycursor.fetchall()
print("******************************")
print("contents in the table are",results)
print("******************************")
count=0
for row in resuults:
print("no. of resulting row",count)
print("**********TOTAL
RECORD:",MYCURSOR.ROWCOUNT,"**********
")
except:
print("error")
def insert():
global mycon,mycursor
print("inserting uservalues into the
useractivity")
userid=int(input("enter the userid"))
taskno=int(input("enter the tasknumber"))
userid_taskno=int(input("enter the
userid_taskno"))
Gender=(input("enter the gender"))
inpstrquery="insert into todolist values({},{},
{},’{}’)".format(userid,taskno,userid_taskno,gend
er)
mycursor.execute(inpstrquery)
mycon.commit()
print("\nRECORD ADDED SUCCESSFULLY!")
def search():
global mycon,mycursor
print("search userid from useractivity")
userid=int(input("enter the userid to be
searched"))
inpstrquery="select * from useractivity where
userid={}".format(userid)
mycursor.execute(inpstrquery)
results=mycursor.fetchall()
if mycursor.rowcount<=0:
print("\n sorry! no matching details
available")
else:
for row in results:
print("no. of resulting rows")
def update():
global mycon,mycursor
print("updating completionstatus of the user")
userid_taskno=int(input("enter the
newuserid_taskno"))
inpstrquery="select * from useractivity where
userid_taskno={}".format(userid_taskno)
mycursor.execute(inpstrquery)
results=mycursor.fetchall()
if mycursor.rowcount<=0:
print("sorry! no matching details available")
else:
for row in results:
print()
ans=input("are you sure to update?(y/n)")
if ans=="y" or ans=="Y":
newtask=input(“enter the new task”)
newtcompletionstatus=(input("enter the new
completionstatus"))
inpstrquery="update useractivity
completionstatus=’{}’ where
userid_taskno={}".format(userid_taskno)
mycursor.execute(inpstrquery)
mycon.commit()
print("\nRECORD UPDATED")
def delete():
global mycon,mycursor
print("deleting user from the useractivity")
userid_taskno=int(input("enter the
userid_taskno to be deleted"))
inpstrquery="select * from useractivity where
userid_taskno={}".format(userid_taskno)
mycursor.execute(inpstrquery)
results=mycursor.fetchall()
if mycursor.rowcount<=0:
print("\##SORRY!NO MATCHING DETAILS
AVAILABLE##")
else:
for row in results:
print()
ans=input("are you sure to delete?(y/n)")
if ans=="y"or ans=="y":
inpstrquery="delete from useractivitywhere
taskno={}"
mycursor.execute(inpstrquery)
mycon.commit()
print("/n record deleted")
display()
insert()
search()
update()
delete()
mycon.close()
OUTPUT
*******************TODOLIST***********************
1.SHOW USER LIST
2.ADD NEW USER
3.SEARCH USE
4.UPDATE USER
5.DELETE USER
6.EXIT
**************************************************
Enter your choice:2
****************** ADD NEW USER ******************
Enter userid : 103415
Enter taskno : 01
Enter userid_taskno : 10341501
Enter gender: female
*********************TODOLIST**********************
1.SHOW USER LIST
2.ADD NEW USER
3.SEARCH USER
4.UPDATE USER
5.DELETE USER
6.EXIT
**************************************************
Enter your choice:1
**************************************************
Userid taskno userid_taskno gender
103813 01 10381301 female
103813 02 10381302 female
103813 03 10381303 female
103813 04 10381304 female
103813 05 10381305 female
103813 06 10381306 female
103813 07 10381307 female
RECORD DELETED