Dbms Mini Project
Dbms Mini Project
Dbms Mini Project
Submitted by
ANBARASAN S 717823P103
DINESH S 717823P113
KABISH D 717823P125
OCTOBER - 2024
VISION
To provide reliable and modern technology resources to the faculty and students to develop
the competence in Information Technology and to endure with the rapidly changing world to
serve the mankind.
MISSION
• Imparting technical knowledge through innovative teaching and research for budding
professionals.
• To equip the students with strong fundamentals, programming and problem solving skills with
an exposure to emerging technologies and inculcate leadership qualities with a passion to
serve society.
• PEO3: Graduates will realize the importance of self-learning and engage in lifelong learning
to become experts either as entrepreneurs or employees in the field to widen the professional
knowledge.
Program Outcomes
• PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering problems.
• PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
• PO3: Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate consideration
for the public health and safety, and the cultural, societal, and environmental considerations.
• PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
• PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
1
• PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
• PO7: Environment and sustainability: Understand the impact of the professional engineering solutions
in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
• PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
• PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
• PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary environments.
• PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
• PSO-1 Ability to organize an IT infrastructure, secure the data and analyze the data analytic
techniques in the field of data mining, big data as to facilitate in solving problems.
• PSO-2 Ability to analyze and design the system in the domain of Cloud and Internet of Things.
2
STUDENT DATABASE MANAGEMENT SYSTEM
1.INTRODUCTION
2.DATABASE DESIGN
3. E-R DIAGRAM
4. DATA DICTIONARY
5. SCHEMA DIAGRAM
6. DATABASE IMPLEMENTION
5.1 Create Schema
5.2 Insert Data values
5.3 Queries (Based on functions, group by, having, joins, sub query etc.)
5.4 PL/SQL Block (Procedures and Exception Handling)
5.5 Function
5.6 Triggers
5.7 Cursors
7. USER INTERFACE
8.CONCLUSION
3
INTRODUCTION
1.1 Abstract:
Our main focus is design a unique Student Management System that will improve Data
management in Institutes experience for both Students and the Administration authorities. The
system is written in MySQL. Student Management System is software which ishelpful for
students as well as the school authorities. In the current system all the activities are done
manually. It is very time consuming and costly. Our Student Management System deals with
the various activities related to the students.
1.2 Introduction
Student Management System is a database which is helpful for students as well as the
school authorities. In the current system all the activities are done manually. It is very time
consuming and costly. Our Student Management System deals with the various activities
related to the students.
• User module
• Student Module
• Mark management
In the Software we can register as a user and user has of two types, student and
administrator. Administrator has the power to add new user and can edit and delete a user. A
student can register as user and can add edit and delete his profile. The administrator can add
edit and delete marks for the student. All the users can see the marks.
The main objective of the project is to design and develop a user friendly-system
Easy to use and an efficient computerized system.
To develop an accurate and flexible system, it will eliminate data redundancy.
To study the functioning of Students management System.
To make a software fast in processing, with good user interface.
To make software with good user interface so that user can change it and it should be
used for a long time without error and maintenance.
To provide synchronized and centralized farmer and seller database.
Computerization can be helpful as a means of saving time and money.
To provide better Graphical User Interface (GUI).
Less chances of information leakage.
Provides Security to the data by using login and password method.
To provide immediate storage and retrieval of data and information.
Improving arrangements for students coordination.
Reducing paperwork.
4
DATABASE DESIGN
HARDWARE REQUIREMENTS:
• Computer with a 1.1 GHz or faster processor
• Minimum 2GB of RAM or more
• 2.5 GB of available hard-disk space
• 5400 RPM hard drive
• 1366 × 768 or higher-resolution display
• DVD-ROM drive
5
EXPLANATION OF CANDIDATE KEY, PRIMARY KEY
Student Marks
A_ID Class Subject Marks
Primary key : A.id is a primary key because it is unique key in which we can obtain all information
through this single key.
Candidate key : No candidate key because except A.id no one attribute can give information about
the students identity.
Foreign Key : No foreign key present in this entity.
Attendance
Student.ID Attendance Class
Primary key : Student.id is a primary key because it is unique key in which we can obtain all
information through this single key.
Candidate key : No candidate key because except A.id no one attribute can give information about
the Route entity.
Foreign Key : No foreign key present in this entity.
2.3 NORMALIZATION:
6
CONCEPTUAL DESIGN:
2.E-R DIAGRAM
7
3.2.1 SCHEMA DIAGRAM:
8
3.2 IMPLEMENTATION:
There have been and are several distinct software packages providing of what we all recognizeas
Python, although some of those are more like distributions or variants of some existing
implementation than a completely new implementation of the language.
Data structures (fields, records, files and objects) optimized to deal with very large
amounts of data stored on a permanent data storage device (which implies relatively slow
access compared to volatile main memory).A database query language and report writer to
allow users to interactively interrogate the database, analyze its data and update it
9
according to the users privileges on data.
➢ Data security prevents unauthorized users from viewing or updating the database.
Using passwords, users are allowed access to the entire database or subsets of it called
sub schemas. For example, an employee database can contain all the data about an
individual employee, but one group of users may be authorized to view only payroll
data, while others are allowed access to only work history and studentdata.
➢ If the DBMS provides a way to interactively enter and update the database, as well as
interrogate it, this capability allows for managing personal databases. However, it may
not leave an audit trail of actions or provide the kinds of controls necessary in a multi-
user organization. These controls are only available when a set of application programs
are customized for each data entry and updating function.
✓ A transaction mechanism, that ideally would guarantee the ACID properties, in order to
ensure data integrity, despite concurrent user accesses (concurrency control), and faults
(fault tolerance).
➢ It also maintains the integrity of the data in the database.
➢ The DBMS can maintain the integrity of the database by not allowing more than one
user to update the same record at the same time. The DBMS can help prevent duplicate
records via unique index constraints; for example, no two customers withthe same
customer numbers (key fields) can be entered into the database. See ACIDproperties for
more information (Redundancy avoidance).
When a DBMS is used, information systems can be changed much more easily as the
organization's information requirements change. to the Organizations may use one kind of
DBMS for daily transaction processing and then move the detail onto another computer that
uses another DBMS better suited for random inquiries and analysis. Overall systems design
decisions are performed by data administrators and systems analysts. Detailed database
designis performed by database administrators.
SQL:
Structured Query Language (SQL) is the language used to manipulate relational databases.
SQL is tied very closely with the relational model.
10
• Data definition: Defining tables and structures in the database (DDL used to
create,alter and drop schema objects such as tables and indexes)
.
4.2 : Stored Procedure
Routine name:
procType:
procedure
Definition: Select * from register;
4.3: Triggers
It is the special kind of stored procedure that automatically executes when an event occurs
inthe database.
Triggers used :
1: Trigger name: on
insertTable: register
Time: after
Event:
insert
INSERT INTO trig VALUES(null,NEW.rid,'Farmer Inserted',NOW())
2: Trigger name: on
deleteTable: register
Time: after
Event:
delete
Definition: INSERT INTO trig VALUES(null,OLD.rid,'FARMER DELETED',NOW())
3: Trigger name: on
updateTable: register
Time: after
Event:
update
Definition: INSERT INTO trig VALUES(null,NEW.rid,'FARMER UPDATED',NOW())
11
BACKEND PYHTON WITH MYSQL CODE
# MY db
connection
local_server=
True
app = Flask( name )
app.secret_key='kusumachandashwini'
@login_manager.user_lo
aderdef
load_user(user_id):
return User.query.get(int(user_id))
12
app.config['SQLALCHEMY_DATABASE_URL']='mysql://username:password@localhost/databa
s_table_ name'
app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:@localhost/students'
db=SQLAlchemy(app)
class Department(db.Model):
cid=db.Column(db.Integer,primary_key=True)
branch=db.Column(db.String(100))
class Attendence(db.Model):
aid=db.Column(db.Integer,primary_key=True)
rollno=db.Column(db.String(100))
attendance=db.Column(db.Integer())
class Trig(db.Model):
tid=db.Column(db.Integer,primary_key=True)
rollno=db.Column(db.String(100))
action=db.Column(db.String(100))
timestamp=db.Column(db.String(100))
class User(UserMixin,db.Model):
id=db.Column(db.Integer,primary_key=True)
username=db.Column(db.String(50))
email=db.Column(db.String(50),unique=True)
password=db.Column(db.String(1000))
13
class Student(db.Model):
id=db.Column(db.Integer,primary_key=True)
rollno=db.Column(db.String(50))
sname=db.Column(db.String(50))
sem=db.Column(db.Integer)
gender=db.Column(db.String(50))
branch=db.Column(db.String(50)) email=db.
Column(db. String(50)) number=db. Column(db.
String(12)) address=db. Column(db. String(100))
@app.route('/')
def index():
return render_template('index.html')
@app.route('/studentdetails')
def studentdetails():
query=db.engine.execute(f"SELECT * FROM
`student`")return
render_template('studentdetails.html',query=query)
@app.route('/triggers')
def triggers():
query=db.engine.execute(f"SELECT * FROM `trig`")
return render_template('triggers.html',query=query)
@app.route('/department',methods=['POST','GET']
)def department():
if request.method=="POST":
dept=request.form.get('dept')
query=Department.query.filter_by(branch=dept).first
()if query:
flash("Department Already
Exist","warning")return
14
redirect('/department')
dep=Department(branch=dept)
db.session.add(dep)
db.session.commit()
flash("Department
Addes","success")
return render_template('department.html')
@app.route('/addattendance',methods=['POST','GET']
) def addattendance():
query=db.engine.execute(f"SELECT * FROM
`student`")if request.method=="POST":
rollno=request.form.get('rollno')
attend=request.form.get('attend')
print(attend,rollno)
atte=Attendence(rollno=rollno,attendance=attend
)db.session.add(atte)
db.session.commit()
flash("Attendance added","warning")
return render_template('attendance.html',query=query)
@app.route('/search',methods=['POST','GE
T'])def search():
if request.method=="POST":
rollno=request.form.get('roll')
bio=Student.query.filter_by(rollno=rollno).first()
attend=Attendence.query.filter_by(rollno=rollno).fi
rst()
return
render_template('search.html',bio=bio,attend=attend) return
render_template('search.html')
15
@app.route("/delete/<string:id>",methods=['POST','GE
T']) @login_required
def delete(id):
db.engine.execute(f"DELETE FROM `student` WHERE
`student`.`id`={id}") flash("Slot Deleted Successful","danger")
return redirect('/studentdetails')
@app.route("/edit/<string:id>",methods=['POST','GET']
) @login_required
def edit(id):
dept=db.engine.execute("SELECT * FROM `department`")
posts=Student.query.filter_by(id=id).first()
if request.method=="POST":
rollno=request.form.get('rollno')
sname=request.form.get('sname')
sem=request.form.get('sem')
gender=request.form.get('gender')
branch=request.form.get('branch')
email=request.form.get('email')
num=request.form.get('num')
address=request.form.get('address')
query=db.engine.execute(f"UPDATE `student`
SET
`rollno`='{rollno}',`sname`='{sname}',`sem`='{sem}',`gender`='{gender}',`branch`='{branch}',`email`='{e
m ail}',`number`='{num}',`address`='{address}'")
flash("Slot is Updates","success")
return redirect('/studentdetails')
return render_template('edit.html',posts=posts,dept=dept)
16
@app.route('/signup',methods=['POST','GET']
)def signup():
if request.method == "POST":
username=request.form.get('username')
email=request.form.get('email')
password=request.form.get('password')
user=User.query.filter_by(email=email).first()
if user:
flash("Email Already
Exist","warning")return
render_template('/signup.html')
encpassword=generate_password_hash(password)
return render_template('signup.html')
@app.route('/login',methods=['POST','GET'])
def login():
if request.method == "POST":
email=request.form.get('email')
password=request.form.get('password')
user=User.query.filter_by(email=email).first()
17
if user and check_password_hash(user.password,password):
login_user(user)
flash("Login
Success","primary") return
redirect(url_for('index'))
else:
flash("invalid
credentials","danger") return
render_template('login.html')
return render_template('login.html')
@app.route('/logou
t') @login_required
def logout():
logout_user
()
flash("Logout
SuccessFul","warning") return
redirect(url_for('login'))
@app.route('/addstudent',methods=['POST','GET'])
@login_required
def addstudent():
dept=db.engine.execute("SELECT * FROM
`department`")if request.method=="POST":
rollno=request.form.get('rollno')
sname=request.form.get('sname')
sem=request.form.get('sem')
gender=request.form.get('gender')
branch=request.form.get('branch')
18
email=request.form.get('email')
num=request.form.get('num')
address=request.form.get('address')
query=db.engine.execute(f"INSERT INTO
`student`
(`rollno`,`sname`,`sem`,`gender`,`branch`,`email`,`number`,`address`)
VALUES ('{rollno}','{sname}','{sem}','{gender}','{branch}','{email}','{num}','{address}')")
flash("Booking Confirmed","info")
return render_template('student.html',dept=dept)
@app.route('/test')
def test():
try:
Test.query.all()
return 'My database is Connected'
except:
return 'My db is not Connected'
app.run(debug=True)
19
FRONT END CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
{% block style %}
{% endblock style %}
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:3
00,400,500,700,800" rel="stylesheet">
</head>
<body>
20
<header id="header">
<div class="container">
<nav id="nav-menu-container">
<ul class="nav-menu">
<li class="{% block home %}
{% endblock home %}"><a href="/">Home</a></li>
<li><a href="/addstudent">Students</a></li>
<li><a href="/addattendance">Attendance</a></li>
<li><a href="/department">Department</a></li>
<li><a href="/triggers">Records</a></li>
<li><a href="/studentdetails">Student Details</a></li>
<li><a href="/search">Search</a></li>
<li><a href="/about">About</a></li>
{% if current_user.is_authenticated %}
<li class="buy-tickets"><a href="">Welcome</a></li>
<li class="buy-tickets"><a href="/logout">Logout</a></li>
{% else %}
<li class="buy-tickets"><a href="/signup">Signin</a></li>
{% endif %}
</ul>
</nav><!-- #nav-menu-container -->
21
pub</div>
</header><!-- End Header -->
{% block body %}
{% with messages=get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% endblock body %}
</body>
</html>
2.Students.html
{% extends 'base.html' %}
{% block title %}Add
Students
{% endblock title %}
{% block body %}
<h3 class="text-center"><span>Add Student Details</span> </h3>
{% with messages=get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{category}} alert-dismissible fade show" role="alert">
{{message}}
23
</div>
{% endfor %}
{% endif %}
{% endwith %}
<br>
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<label for="sem">Sem</label>
<input type="number" class="form-control" name="sem" id="sem">
</div>
<br>
<div class="form-group">
<select class="form-control" id="gender" name="gender" required>
<option selected>Select Gender</option>
24
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>
<br>
<div class="form-group">
<select class="form-control" id="branch" name="branch" required>
<option selected>Select Branch</option>
{% for d in dept %}
<option value="{{d.branch}}">{{d.branch}}</option>
{% endfor %}
</select>
</div>
<br>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" name="email" id="email">
</div>
<br>
<div class="form-group">
<label for="num">Phone Number</label>
<input type="number" class="form-control" name="num" id="num">
</div>
<br>
<div class="form-group">
<label for="address">Address</label>
<textarea class="form-control" name="address" id="address"></textarea>
</div>
<br>
25
<button type="submit" class="btn btn-danger btn-sm btn-block">Add Record</button>
</form>
<br>
<br>
</div>
<div class="col-md-4"></div>
</div></div>
{% endblock body %}
26
USER INTERFACE
LOGIN PAGE:
27
ADD STUDENTS INFO
28
TRIGGERS RECORDS
29
30
DATABASE LOCALHOST
31
32
33
CONCLUSION
Using MySQL as the database is highly beneficial as it is free to download, popular and can be
easily customized. The data stored in the MySQL database can easily be retrieved and
manipulated according to the requirements with basic knowledge of SQL.
With the theoretical inclination of our syllabus it becomes very essential to take the atmost
advantage of any opportunity of gaining practical experience that comes along. The building
blocks of this Major Project “Students Management System” was one of these opportunities.It
gave us the requisite practical knowledge to supplement the already taught theoretical concepts
thus making us more competent as a computer engineer. The project from a personalpoint of
view also helped us in understanding the following aspects of project development:
FUTURE ENHANCEMENT
REFERENCES
• https://www.youtube.com
• https://www.google.com
• http://www.getbootstrap.com
34
35