FINAL

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

TIRUCHIRAPPALLI

COLLEGE OF ENGINEERING AND TECHNOLOGY


TIRUCHIRAPPALLI

21CSC205P Database Management


Systems

Project Report

Register No : RA2211003050151

Name of the Student : JAISREE N

Semester : 4TH SEMESTER

Programme : B.Tech.CSE

Academic Year : 2023-2024


SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
TIRUCHIRAPPALLI

COLLEGE OF ENGINEERING AND TECHNOLOGY


TIRUCHIRAPPALLI

REGISTER NO : RA2211003050151

BONAFIDE CERTIFICATE

Certified as the bonafide record of work done by JAISREE N, Register No.


RA2211003050151 of 4TH / II (Semester/Year), B.Tech.Computer Science and
Engineering, Programme in the project-based course 21CSC205P, Database
Management Systems at SRM Institute of Science and Technology, Tiruchirappalli
Campus during the Academic Year 2023-2024.

Faculty In-charge Head of the Department

Submitted for the End Semester Examination held on

Examiner-1 Examiner-2
SRM Institute of Science and Technology
Faculty of Engineering and Technology
School of Computing
Department of Computational Intelligence
VISION AND MISSION OF THE DEPARTMENT
Vision
To become a world-class department in imparting high-quality knowledge and providing students
with a unique learning and research experience in Computer Science and Engineering.

Mission

1. To impart knowledge in cutting edge technologies in part with industrial standards.


2. To collaborate with renowned academic institutions in research and development.
3. To instill societal and ethical responsibilities in all professional activities.

Program Educational Objectives (PEO)


PEO - 1 Graduates will be able to perform in technical/managerial roles ranging from design,
development, problem solving to production support in software industries and R&D sectors

PEO - 2 Graduates will be able to successfully pursue higher education in reputed institutions.

PEO - 3 Graduates will have the ability to adapt, contribute and innovate new technologies and
systems in the key domains of Computer Science and Engineering.

3
PEO - 4 Graduates will be ethically and socially responsible solution providers and
entrepreneurs in Computer Science and other engineering disciplines.

PEO - 5 Graduates will possess the additional skills in core computer science discipline with
knowledge of Hardware, Software, Programming, Logic & Reasoning.

Mission of the Department to Program Educational Objectives (PEO) Mapping

H – High correlation, M – Medium Correlation, L – Low Correlation

Program Outcomes as defined by NBA (PO)


Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. 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.
3. 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.
4. 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.
5. 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.

4
6. 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.
7. 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.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader
in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
11. 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.
12. 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 – Program Specific Outcomes (PSO)

Mapping Program Educational Objectives (PEO) to Program Learning Outcomes (PLO)

5
H – High correlation, M – Medium Correlation, L – Low Correlation

COURSE DESIGN

Course Learning At the end of this course, learners will be able to:
Outcomes (CLO):
CO – 1 Acquire knowledge on DBMS architecture and languages
CO – 2 Acquire knowledge on Relational languages and design a database
CO – 3 Implement the Database structure with SQL
CO – 4 Removal of anomalies using Normalization concepts
CO – 5 Visualizing storage structure, handling concurrency, Failure and
recovery principles, NoSQL concept

CLO-PO Mapping

CLO Program Outcomes (PO)


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Engineering Knowledge

Design & Development

Project Mgt. & Finance


Modern Tool Usage

Life Long Learning


Individual & Team
Society & Culture
Problem Analysis

Analysis, Design,

Communication
Environment &
Sustainability
Research

PSO – 3
PSO - 1

PSO - 2
Ethics

Work

CO1 - 2 - - - - - - - - - - 2 1 -
CO2 1 2 - - - - - - - - - - 2 1 -
CO3 1 - 2 - - - - - - - - - 2 1 -
CO4 1 - - - - - - - - - - - 2 1 -
CO5 1 2 - - - - - - - - - - 2 1 -

6
Report Evaluation:

Test
Date Artifacts Total
Components Mark Split-up
Marks

Marks to be evaluated based on


1 (a) 23.01.2024 Project Title selection, presentation
Abstract Project title – 2 Marks
04
Presentation – 2 Marks

Problem understanding, Marks to be evaluated based on


Identification of Entity and presentation and demo
1 (b)
07-02-2024
Relationships, Problem Identification – 1 Marks
Construction of DB using Presentation – 2 Marks
ER Model for their project 06 Demo - 2 Marks
Viva - 1 Marks

Marks to be evaluated based on demo


Design of Relational
and viva voce
Schemas, Creation of
2 28-02-2024 Demo - 4 Marks
Database and their Tables
10 Viva voce – 3 Marks
for their project
Report - 3 Marks

Marks to be evaluated based on demo


Writing the complex queries
and viva voce
based on the concepts of
27-03-2024 Demo - 4 Marks
3 constraints, sets, joins,
10 Viva - 3 Marks
views, Triggers and Cursors
Report -3 Marks

7
Marks to be evaluated based on demo
Analyzing the pitfalls, and viva voce
27-03-2024 identifying the dependencies Demo - 4 Marks
4 and applying normalizations 10 Viva - 3 Marks
Report - 3 Marks

Marks to be evaluated based on demo


Implementation of and viva voce
27-03-2024 concurrency control and Demo - 4 Marks
5
recovery mechanisms. 10 Viva - 3 Marks
Report - 3 Marks
Marks to be evaluated based on
presentation and demo
Module Description and Final Presentation - 2
6 15-04-2024
Functionalities 10 Demo - 2 Marks
Viva - 3 Marks
Report - 3 Marks
Marks to be evaluated based on
Database Connectivity and presentation and demo
Final Presentation - 2
7 15-04-2024 Embedded SQL 10
Demo - 2 Marks
operations Viva - 3 Marks
Report - 3 Marks
Marks to be evaluated based on
presentation and demo
PL/SQL procedures to
Final Presentation - 2
8 29-04-2024 Operate on the database 10
Demo - 2 Marks
of your project Viva - 3 Marks
Report - 3 Marks
Marks to be evaluated based on
presentation and demo
Final Presentation - 2
9 29-04-2024 Front End Design 10
Demo - 2 Marks
Viva - 3 Marks
Report - 3 Marks
Marks to be evaluated based on
presentation and demo
Report Generation using
Final Presentation - 2
10 07-05-2024 Crystal Reports/Report 10
Demo - 2 Marks
Generation Tool Viva - 3 Marks
Report - 3 Marks

8
LABORATORY EXPERIMENTS MAPPED WITH CLO, PO, PSO

Sl. CLO PO / PSO


Title of the Experiments
No. Mapping Mapping
1 (a) Project Title selection, Abstract 1 2
(b) Problem understanding, Identification of Entity
and Relationships, Construction of DB using ER
Model for your project
2 Design of Relational Schemas, Creation of Database 1,2 1,2
and Tables for your project
3 SQL Queries based on the concepts of constraints, 3 1,3
sets, joins
4 Applying Normalization for your project 4 1

5 Concurrency control and Recovery mechanisms for 5 1,2


your project
6 Module Description and Functionalities 1,2 1,2

7 Database Connectivity and Embedded SQLoperations 1,2 1,2

8 PL/SQL procedures to Operate on the database of 2,3 1,2,3


your project
9 Front End Design, Sample Code for each module, 5 1,2
Screen Shots for each module
10 Report Generation using Crystal Reports/Report 5 1,2
Generation Tool

9
INDEX
Expt. Date of Name of the Page Marks Signature
No. Experiment Experiment No. (50) of Faculty

1 07-02-2024 (a) Project Title selection,


Abstract

(b)Problem understanding, 11-12


Identification of Entity and
Relationships, Construction
of DB using ER Model for
your project
2 28-02-2024 Design of Relational
Schemas, Creation of
13-17
Database and Tables for your
project
3 27-03-2024 SQL Queries based on the
concepts of constraints, sets, 18-19
joins
4 27-03-2024 Applying Normalization for
20-21
your project
5 27-03-2024 Concurrency control and
Recovery mechanisms for 22-23
your project
6 15-04-2024 Module Description and
24-25
Functionalities
7 15-04-2024 Database Connectivity and
Embedded 26-29
SQL operations
8 29-04-2024 PL/SQL procedures to
Operate on the database of 30-31
your project
9 29-04-2024 Front End Design, Sample
Code foreach module, Screen 32-34
Shots for eachmodule
10 07-05-2024 Report Generation using
Crystal Reports/Report 34-35
Generation Tool
11 07-05-2024 Online Course Completion 35-36
Certificate

10
EXP.NO: 1

DAILY EXPENSE TRACKER

ABSTRACT

This abstract presents a PHP-MySQL based daily expense tracker designed to offer users a secure, efficient, and
user-friendly platform for managing their financial transactions. The system comprises three key tables:
"expenses," "expense_categories," and "users," facilitating organized data management and user authentication.
The "expenses" table stores detailed transaction information, including amount, date, description, and category,
ensuring accurate record-keeping and easy retrieval of expenditure data. Meanwhile, the "expense_categories"
table enables users to categorize expenses for streamlined analysis and budgeting purposes. Implemented through
PHP scripting, the system provides a secure login mechanism managed by the "users" table, ensuring only
authorized individuals can access and modify their financial data. With its intuitive interface, users can
seamlessly input, view, and manage their daily expenses, empowering them to make informed financial decisions
and achieve their budgeting goals effectively.

PROBLEM STATEMENT

Many individuals face challenges in effectively managing their daily expenses due to the limitations of existing
solutions:

1. Inefficient Expense Tracking: Current methods of expense tracking often result in disorganized financial
records, making it difficult for individuals to monitor their spending habits accurately.

2. Lack of User-Friendly Solutions: Many available expense tracking systems lack a user-friendly interface,
hindering users' ability to input, categorize, and analyze their expenses efficiently.

3. Security Concerns: Security vulnerabilities in existing expense tracking applications pose risks to users'
financial data, potentially leading to unauthorized access or data breaches.

4. Limited Features: Some expense tracking solutions offer only basic features, such as recording expenses
without robust categorization or analysis capabilities, limiting users' ability to gain insights into their
spending patterns. 11
These challenges underscore the need for a comprehensive daily expense tracker that integrates secure
authentication, efficient data management, intuitive user interface, and robust categorization and analysis
features. Such a solution would empower individuals to manage their finances effectively, make informed
financial decisions, and achieve their budgeting goals with confidence.

ENTITY - RELATIONSHIP DIAGRAM

12
EXP.NO:2

RELATIONAL SCHEMA

DATABASE CREATION

1. Creating expenses table named “expenses”

CREATE TABLE `expenses` (


`expense_id` int(20) NOT NULL,
`user_id` varchar(15) NOT NULL,
`expense` int(20) NOT NULL,
`expensedate` varchar(15) NOT NULL,
`expensecategory` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

13
Dumping data for table `expenses`

INSERT INTO `expenses` (`expense_id`, `user_id`, `expense`, `expensedate`, `expensecategory`) VALUES


(101, '9', 789, '2023-08-31', 'Medicine'),
(102, '9', 3, '2023-08-31', 'Entertainment'),
(103, '9', 469, '2023-08-29', 'Clothings'),
(104, '9', 985, '2023-08-25', 'Entertainment'),
(105, '12', 3, '2023-08-31', 'Clothings'),
(106, '12', 89, '2023-08-16', 'Bills & Recharges'),
(107, '9', 3, '2023-09-06', 'Clothings'),
(108, '9', 300, '2023-07-04', 'Food'),
(109, '9', 456, '2023-09-01', 'Clothings'),
(110, '9', 3, '2023-08-28', 'Entertainment'),
(111, '9', 300, '2023-09-03', 'Clothings'),
(112, '9', 789, '2021-06-03', 'Medicine'),
(113, '9', 756, '2021-02-23', 'Entertainment'),
(114, '9', 123, '2022-09-03', 'Medicine'),
(115, '9', 256, '2021-09-07', 'Medicine'),
(116, '9', 798, '2023-09-04', 'Medicine'),
(117, '9', 45, '2023-08-28', 'Entertainment'),
(118, '9', 50, '2023-10-20', 'Medicine'),
(119, '9', 786, '2023-10-20', 'Food'),
(120, '9', 1000, '2023-10-04', 'Entertainment'),
(121, '9', 500, '2023-10-19', 'Clothings'),
(122, '9', 426, '2023-10-16', 'Household Items’);

14
2.Creating expense categories table named “expense_categories”

CREATE TABLE `expense_categories` (


`category_id` int(11) NOT NULL,
`category_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
15
Dumping data for table `expense_categories`

INSERT INTO `expense_categories` (`category_id`, `category_name`) VALUES


(1, 'Medicine'),
(2, 'Food'),
(3, 'Bills & Recharges'),
(4, 'Entertainment'),
(5, 'Clothings'),
(6, 'Rent'),
(7, 'Household Items'),
(8, 'Others');

3.Creating users table named “users”

CREATE TABLE `users` (


`user_id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(25) NOT NULL,
`email` varchar(50) NOT NULL, 16
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

Dumping data for table `users`

INSERT INTO `tblphlebotomist` (`id`, `EmpID`, `FullName`, `MobileNumber`, `RegDate`) VALUES


(3, '12587493', 'Amit Singh', 9876543212, '2021-05-03 04:51:44'),
(4, '105202365', 'Rahul', 8529631470, '2021-05-03 04:52:06'),
(5, '10802364', 'Sanjeev Tomar', 1234567890, '2021-05-08 09:34:11');

17
EXP.NO:3

CONSTRAINTS
• Query to create a table with constraints:
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
department_id INT,
FOREIGN KEY (department_id) REFERENCES departments(department_id)
);

• Query to add a unique constraint:


ALTER TABLE employees
ADD CONSTRAINT uc_email UNIQUE (email);

SETS
• Query to find the union of two tables:
SELECT * FROM table1
UNION
SELECT * FROM table2;

• Query to find the intersection of two tables:


SELECT * FROM table1
INTERSECT
SELECT * FROM table2;

18
JOINS
• Query to perform an inner join:
SELECT *
FROM orders
INNER JOIN customers ON orders.customer_id = customers.customer_id;

• Query to perform a left join:


SELECT *
FROM departments
LEFT JOIN employees ON departments.department_id = employees.department_id;

• Query to perform a right join:SELECT *


FROM employees
RIGHT JOIN departments ON employees.department_id = departments.department_id;

• Query to perform a full outer join:


SELECT *
FROM employees
FULL OUTER JOIN departments ON employees.department_id = departments.department_id;

• Query to join multiple tables:


SELECT *
FROM orders
JOIN customers ON orders.customer_id = customers.customer_id
JOIN employees ON orders.employee_id = employees.employee_id;

19
EXP.NO:4

APPLYING NORMALIZATION FOR MY PROJECT

1. First Normal Form (1NF):


• Ensure that each column contains atomic values.
• There should be no repeating groups within rows.
• Each table should have a primary key.
Action:
• All tables already satisfy the requirements of 1NF.
2. Second Normal Form (2NF):
• In our schema, the "expenses" table needs attention. The "expensecategory" column is partially dependent on
the primary key (expense_id). We need to move it to a separate table.
Action:
Let's create a new table for expense categories:
CREATE TABLE expense_categories (
category_id INT PRIMARY KEY,
category_name VARCHAR(255) UNIQUE
);

ALTER TABLE expenses


ADD COLUMN category_id INT,
ADD FOREIGN KEY (category_id) REFERENCES expense_categories(category_id);
3. Third Normal Form (3NF):
• Ensure that the table is in 2NF, and there are no transitive dependencies.
• In our schema, there are no evident transitive dependencies. All tables are already in 3NF.
Action:
• Identify and eliminate transitive dependencies in the tables.

20
Normalization Actions:

4. Boyce-Codd Normal Form (BCNF):


• BCNF is an extension of 3NF.
• In BCNF, every determinant (attribute whose value determines another value in the same row) is a candidate
key.

5. Fourth Normal Form (4NF):


• In 4NF, there should be no multi-valued dependencies.
• If a table has multi-valued dependencies, we decompose it into smaller tables to remove them.

6. Fifth Normal Form (5NF):


• In 5NF, there should be no join dependencies.
• If a table has join dependencies, we decompose it into smaller tables to remove them. 21
EXP.NO:5

Implementation of Concurrency control and Recovery mechanisms:

1. Concurrency Control:

• Locking Mechanisms: Implement locks to control access to critical resources such as patient records, test results,
and administrative functions. Use shared locks for read operations and exclusive locks for write operations to
prevent conflicts.
• Timestamp-based Concurrency Control: Assign timestamps to transactions and use them to order and schedule
concurrent transactions. Ensure that transactions with conflicting operations are executed in the correct order to
maintain consistency.
• Optimistic Concurrency Control: Given that the system deals with a significant number of read operations,
consider optimistic concurrency control techniques such as validation checks at the time of commit to detect
conflicts.
• Multi-Version Concurrency Control (MVCC): Maintain multiple versions of test records to allow concurrent
transactions to access data without blocking. Use timestamps or version numbers to ensure data consistency.

2. Recovery Mechanisms:

• Transaction Logging: Log all database modifications, including patient registrations, test orders, and test results.
Use a robust logging mechanism to ensure that changes are recorded before they are applied to the database.
• Checkpointing: Periodically save the current state of the database to stable storage to provide a starting point for
recovery in case of a system crash. Consider scheduling checkpoints during off-peak hours to minimize disruption.
• Transaction Rollback: Implement mechanisms to rollback incomplete transactions in case of failures or user
aborts. Ensure that partial changes made by aborted transactions are undone to maintain database consistency.
• Undo/Redo Logging: Log both undo and redo information to support database recovery. In the event of a crash,
use redo logs to reapply committed transactions and undo logs to rollback uncommitted changes.
• Savepoints: Allow transactions to define savepoints to mark intermediate states. This enables users to rollback to a
specific point in case of errors without losing all transaction progress.

3. Isolation Levels:

• Define appropriate isolation levels to control the visibility of data changes to concurrent transactions. Given the
sensitivity of patient data, consider using a higher isolation level such as Serializable to ensure strict data
consistency.
• Ensure that transactions are executed in a consistent manner, considering factors like data integrity, confidentiality,
and performance.

4. Distributed Database Considerations:


22
• If your system is distributed across multiple testing labs or facilities, ensure that concurrency control and recovery
mechanisms are designed to work in a distributed environment.
• Implement distributed deadlock detection algorithms to detect and resolve deadlocks between distributed
transactions.
• Use distributed commit protocols such as Two-Phase Commit (2PC) to coordinate transaction commits across
distributed nodes and ensure atomicity and consistency.

23
EXP.NO:6

Module Description and Functionalities

1. User Management Module:


• Functionality: This module manages user accounts and authentication within the system.
• Features:
• User registration: Allows users to create new accounts by providing necessary details like name,
email, and password.
• User login: Enables registered users to log in to the system securely.
• User profile management: Allows users to view and update their profile information, such as name,
email, and password.
• Authentication and authorization: Ensures that only authenticated users have access to the system's
functionalities.
2. Expense Tracking Module:
• Functionality: This module facilitates the recording and management of expenses by users.
• Features:
• Expense creation: Allows users to add new expenses by specifying details such as amount, category,
and date.
• Expense listing: Displays a list of all expenses recorded by the user, along with their details.
• Expense categorization: Enables users to categorize expenses into predefined categories (e.g., food,
transportation, utilities).
• Expense editing and deletion: Allows users to edit or delete existing expenses as needed.
• Expense filtering and searching: Provides options to filter and search expenses based on criteria such
as date range, category, or amount.
3. Reporting Module:
• Functionality: This module generates reports and visualizations based on the recorded expenses.
• Features:
• Expense summary report: Generates a summary report showing total expenses by category or month.
• Expense trend analysis: Visualizes expense trends over time using charts or graphs.
• Budget tracking: Helps users track their expenses against predefined budgets and provides alerts for
overspending.
• Exporting and sharing: Allows users to export expense reports in various formats (e.g., PDF, CSV)
and share them with others.
4. Notification Module:
• Functionality: This module sends notifications to users for important events and reminders related to
expenses.
• Features:
• Expense reminders: Sends notifications to remind users of upcoming bill payments or pending
expenses.
• 24
Budget alerts: Notifies users when they exceed predefined budget limits or reach certain spending
thresholds.
• System updates: Sends notifications about system maintenance, new features, or policy changes.
5. Settings Module:
• Functionality: This module allows users to configure and customize various settings within the application.
• Features:
• Account settings: Allows users to manage account preferences, such as language, timezone, and
notification preferences.
• Expense categories management: Enables users to customize expense categories, add new
categories, or modify existing ones.
• Currency settings: Allows users to configure the currency format and exchange rates for multi-
currency support.
• Data backup and synchronization: Provides options for backing up expense data and synchronizing it
across multiple devices.
6. Admin Module:
• Functionality: This module provides administrative functionalities for system administrators or moderators.
• Features:
• User management: Allows administrators to manage user accounts, including creation, suspension,
or deletion.
• Expense moderation: Enables moderators to review and approve expenses submitted by users before
they are finalized.
• System configuration: Provides access to system-wide settings and configurations, such as email
templates, access controls, and logging.

25
EXP.NO:7

DATABASE CONNECTIVITY

<?php
$con = mysqli_connect("localhost","root","","dailyexpense");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error() ." | Seems like you haven't created the
DATABASE with an exact name";
}
?>

SQL CONNECTION

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";


START TRANSACTION;
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;


/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `dailyexpense`
--

-- --------------------------------------------------------

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (


`expense_id` int(20) NOT NULL,
`user_id` varchar(15) NOT NULL,
`expense` int(20) NOT NULL,
`expensedate` varchar(15) NOT NULL,
`expensecategory` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
26
--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`expense_id`, `user_id`, `expense`, `expensedate`, `expensecategory`) VALUES


(101, '9', 789, '2023-08-31', 'Medicine'),
(102, '9', 3, '2023-08-31', 'Entertainment'),
(103, '9', 469, '2023-08-29', 'Clothings'),
(104, '9', 985, '2023-08-25', 'Entertainment'),
(105, '12', 3, '2023-08-31', 'Clothings'),
(106, '12', 89, '2023-08-16', 'Bills & Recharges'),
(107, '9', 3, '2023-09-06', 'Clothings'),
(108, '9', 300, '2023-07-04', 'Food'),
(109, '9', 456, '2023-09-01', 'Clothings'),
(110, '9', 3, '2023-08-28', 'Entertainment'),
(111, '9', 300, '2023-09-03', 'Clothings'),
(112, '9', 789, '2021-06-03', 'Medicine'),
(113, '9', 756, '2021-02-23', 'Entertainment'),
(114, '9', 123, '2022-09-03', 'Medicine'),
(115, '9', 256, '2021-09-07', 'Medicine'),
(116, '9', 798, '2023-09-04', 'Medicine'),
(117, '9', 45, '2023-08-28', 'Entertainment'),
(118, '9', 50, '2023-10-20', 'Medicine'),
(119, '9', 786, '2023-10-20', 'Food'),
(120, '9', 1000, '2023-10-04', 'Entertainment'),
(121, '9', 500, '2023-10-19', 'Clothings'),
(122, '9', 426, '2023-10-16', 'Household Items');

-- --------------------------------------------------------

--
-- Table structure for table `expense_categories`
--

CREATE TABLE `expense_categories` (


`category_id` int(11) NOT NULL,
`category_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `expense_categories`
--

INSERT INTO `expense_categories` (`category_id`, `category_name`) VALUES


(1, 'Medicine'),
(2, 'Food'),
(3, 'Bills & Recharges'),
(4, 'Entertainment'),
(5, 'Clothings'),
(6, 'Rent'),
(7, 'Household Items'), 27
(8, 'Others');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (


`user_id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(25) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`user_id`, `firstname`, `lastname`, `email`, `password`) VALUES


(9, 'Anjalita', 'Fernandes', '[email protected]', 'b7161ae9080c2604adb157463312ed47'),
(12, 'Ebey', 'Joe Regi', '[email protected]', '25d55ad283aa400af464c76d713c07ad');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
ADD PRIMARY KEY (`expense_id`);

--
-- Indexes for table `expense_categories`
--
ALTER TABLE `expense_categories`
ADD PRIMARY KEY (`category_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

-- 28
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
MODIFY `expense_id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=123;

--
-- AUTO_INCREMENT for table `expense_categories`
--
ALTER TABLE `expense_categories`
MODIFY `category_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;


/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

29
EXP.NO:8

PL/SQL procedures to Operate on the database of my project


1. Insert Procedure
CREATE OR REPLACE PROCEDURE add_expense (
p_user_id IN NUMBER,
p_amount IN NUMBER,
p_expense_date IN DATE,
p_category_id IN NUMBER
) AS
BEGIN
INSERT INTO expenses (user_id, expense, expensedate, category_id)
VALUES (p_user_id, p_amount, p_expense_date, p_category_id);
COMMIT;
END add_expense;
/

2. Update Procedure
CREATE OR REPLACE PROCEDURE update_expense (
p_expense_id IN NUMBER,
p_amount IN NUMBER,
p_expense_date IN DATE,
p_category_id IN NUMBER
) AS
BEGIN
UPDATE expenses
SET expense = p_amount,
expensedate = p_expense_date,
category_id = p_category_id
WHERE expense_id = p_expense_id;
COMMIT;
END update_expense;
/

3. Delete Procedure
CREATE OR REPLACE PROCEDURE delete_expense (
p_expense_id IN NUMBER
) AS
BEGIN
DELETE FROM expenses
WHERE expense_id = p_expense_id;
COMMIT;
END delete_expense;
/

30
4. Retrieval Procedure

CREATE OR REPLACE PROCEDURE get_expenses (


p_user_id IN NUMBER,
p_start_date IN DATE,
p_end_date IN DATE
) AS
BEGIN
SELECT *
FROM expenses
WHERE user_id = p_user_id
AND expensedate BETWEEN p_start_date AND p_end_date;
END get_expenses;
/

31
EXP.NO:9

FRONT END

1. LOGIN

2. DAHSBOARD

32
3ADD EXPENSES

4. MANAGE EXPENSES

33
5. EXPENSE REPORT

6. PROFILE

34
EXP.NO:10

REPORT GENERATION

35
EXP.NO:11

ONLINE COURSE COMPLETION CERTIFICATE

CONCLUSION
In conclusion, the expense tracking project represents a robust and user-centric solution designed to empower
individuals and businesses in managing their financial activities efficiently. Through a combination of modern
technologies and database management principles, the project offers a comprehensive suite of functionalities
tailored to meet the diverse needs of users. By leveraging the user management module, individuals can create
accounts securely, log in seamlessly, and personalize their profiles to suit their preferences. The expense
tracking module serves as the cornerstone of the project, enabling users to record, categorize, and analyze their
expenses effectively. This functionality not only provides users with valuable insights into their spending habits
but also equips them with the tools necessary to make informed financial decisions. Additionally, the reporting
module offers detailed reports and visualizations, allowing users to track their expenses over time and monitor
adherence to budgetary constraints. 36

You might also like