0% found this document useful (0 votes)
7 views30 pages

Csproject

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 30

PROJECT FILE

Computer Science

Shivam Sharma

Class: XII-F

Admission no:23135173
Certificate
This Project is a bona fide work of
Shivam Sharma of Class XII – F of
session 2024-25. Performed under
guidance of Mrs. Puja Gupta (PGT:
Computer Science, Mount Carmel
School, Dwarka).

Teacher’s Signature

_______________________
Acknowledgement
We thank our Computer Science
teacher, Mrs. Puja Gupta for her
invaluable guidance and the knowledge
she imparted through the year. We
would also like to thank our parents
who helped us a lot in finalizing this
file within a limited time frame. We
also extend my heartfelt gratitude to
the creators/authors of the various
sources we utilized to obtain relevant
information for this file.
Index

 Mind map
 Project Description
 MySQL
 Database structure
 Modules used
 Methods created
 Utility methods
 Preparing Database
 Inserting records
 Modifying records
 Searching records
 Display records
 Deleting records
 Main menu
Mind Map

Main Prepari
Deleting Menu ng
Records
Databse

Students
Marks Insertin
Display Managem
Records g
ent Records
System

Searchi Modifyin
ng g
Records Records
Project Description
Topic: MySQL Connectivity in Python

MySQL Version: MYSQL Server 8.0.0

Name: Students Marks Management


System

About: This project manages and


stores
student records electronically
according to
the needs of school. The system
helps the
teacher to keep constant track of
all
student’s marks and their grades
thereby
improving efficiency of school.

MYSQLs
MySQL is an open-source relational
database management system. Its
name is a combination of "My" (the
name of co-founder Michael Widenius's
daughter) and "SQL", the acronym for
Structured Query Language. It is a
widely used relational database
management system (RDBMS)which is
free and open-source. Itis idle for all
work uses from small applications to
big corporate organizations.

Database Structure
 Database Name: csprac
 Table Name: stu_records
 Table Structure
 Rollno: Roll number of the
student(integer)
 Class: Grade and section of the
student (varchar(10))
 Name:Name of the student
(varchar(50))
 DOB: Date of birth of the student
(date)
 Marks: Marks scored by the student
(int)

Modules Used
MySQL.connector module
Python module to connect to MySQL
server by using credentials and use
SQL commands through python into
the database. Here, we use the alias
“mc” to prevent repeating the long
module name. It provides a “connect”
function which takes in credentials
such as user, password, host and an
optional argument of database. The
connection object also has the commit
function which saves the data after
using a DML command
 mc.connect(credentials)
 con.commit()
The connection object provides a
‘cursor’ via which we can run SQL
commands.
 con.cursor()
The cursor object provides a function
‘execute’ in which we write the SQL
statements we want to run.
 cursor.execute()
datetime module:
Python datetime module supplies
classes for manipulating dates and
times. In this project it is used to
validate user input dates.
Methods created
1)Utility Methods
1)Check_valid_date
2)Preparing database
1)create DB
2)create TB
3)Insert
4)Modify
5)Search by roll number
6)Display methods:
1)Display all
2)Display above 90
3)Display below 33
7)Delete
8)Menu
Utility Methods

Check_valid_date:
Helps to validate whether the date
is in correct form of yyyy-mm-dd
Preparing Databases

createDB():Creates the Database


“Csproject” if it does not exist
already.
createTB():Creates the Table “emp”
if it does not exist already with roll
number as primary key.

Output:
Inserting Record

The ‘insert’ function is used to enter


details of the students.
Output:
Modifying Records

The ‘modify’ function is used to update


details of the students.
Output:
Search Records By Roll
Number

The ‘search_rollno’ function is used to


find details of any student using their
roll number
Output:
Display Methods

The ‘display_all’ function is used to


display details of all students.

Output:
The ‘display_above_90’ function is used
to display details of students who have
scored above 90 marks.

Output:
The ‘display_below_33’ function is used
to display details of students who have
scored below 33.

Output:
Deleting records

The ‘delete’ function is used to delete


record of a student using their roll
number.
Output:

Original Table

New Table
Menu
The ‘menu’ function displays all the
methods and asks the user what to do
they want to do.

Output:

You might also like