My SQLproject REPORT
My SQLproject REPORT
Submitted by
KAVIYUGA.M.V (22BCA053)
Guided by,
DEPARTMENT OF BCA
PSGR KRISHNAMMAL COLLEGE FOR WOMEN
College of Excellence
An Autonomous Institution, Affiliated to Bharathiyar University
Accredited with ‘A++’ Grade by NACC, An ISO 9001:2015 Certified Institution
Peelamedu, Coimbatore-641004.
November 2023
CERTIFICATE
This is to certify that this DBMS project entitled “ORGANIC SHOP SALES INVENTORY
DATABASE MANAGEMENT SYSTEM” Submitted to PSGR Krishnammal College for
Women, Coimbatore in partial fulfillment of the requirement for the award of the Degree of
Bachelor of Computer Applications is a record of original work done by KAVIYUGA.M.V
(22BCA053) during her period of study in Department of BCA, PSGR Krishnammal College
for Women, Coimbatore under my supervision and guidance and her DBMS Project has not
formed the basis for the award of any Degree/ Diploma/ Associate/ Fellowship or similar title
to any candidate of any university.
Forwarded by
_________________________ ____________________________
Faculty Guide Head of the Department
Dr. R. HEPZIBA GNANAMALAR Mrs. K. GEETHALAKSHMI
MCA., Ph.D. MCA., M Phil., B.Ed., (Ph.D.)
________________ ________________
Internal Examiner External Examiner
DECLARATION
I hereby declare that the DBMS project entitled “ORGANIC SHOP SALES INVENTORY
DATABASE MANAGEMENT SYSTEM” submitted to PSGR Krishnammal College for
Women, Coimbatore for the award of the Degree of Bachelor of Computer Application is a
record of original work done by KAVIYUGA.M.V (22BCA053) under the guidance of
Dr.R.HEPZIBA GNANAMALAR MCA., Ph.D., Assistant Professor, Department of
BCA, PSGR Krishnammal College for Women, Coimbatore and this project have not found
the basis for the award of any Degree/Diploma or similar title to any candidate of any
university.
Endorsed by
S No TITLE Page No
1 CASE STUDY
1.1. Abstract
1.2. Problem Definition
1.3. Objective
1.4. Table Description
2 NORMALIZATION
3 ER DIAGRAM
4.1. Create
4.2. Alter
4.3. Drop
4.4. Truncate
4.5. Rename
5.1. Select
5.2. Insert
5.3. Update
5.4. Delete
6.1. Grant
6.2. Revoke
7 TRANSACTION CONTROL LANGUAGE
7.1. Commit
7.2. Rollback
7.3. Savepoint
9.1. Avg()
9.2. Count()
9.3. Sum()
9.4. Min()
9.5. Max()
9.6. Asc
9.7. Desc
10 JOINS
10.1. Join
10.2. Left Inner Join
10.3. Right Inner Join
10.4. Full Join
10.5. Left Outer Join
10.6. Right Outer Join
10.7. Full Outer Join
11 SUB QUERIES
12 CONCLUSION
1.1. ABSTRACT :
Pure Petals is a retail company specializing in organic and natural products including essential
oils and plant-based skincare, promoting the use of chemical-free and sustainable products that
nurture both the body and the environment. The company has been operating for several years
and has a significant customer base.
Pure Petals is facing challenges in efficiently managing its vast inventory. The current order
processing system is manual and error-prone. Accessing information from physical books was
time-consuming, especially when searching for specific data. It required manual browsing
through pages, making data retrieval slow and inefficient. Physical books are susceptible to
damage, loss, or theft, posing significant data security risks.
SOLUTION :
They need a database system to track product quantities and ensure real-time updates to prevent
overselling or stockouts. They want to implement a digital order management system to
streamline the process, and handle high volumes of orders. Pure Petals decides to develop a
database management system to address the mentioned challenges and enhance their overall
operations. The database will be designed using a relational model with appropriate tables and
relationships.
Thus, the company will experience improved inventory management and streamlined order
processing.
1.3. OBJECTIVES :
a. Efficient Inventory Management: Design and implement a database system that enables
Pure Petals to efficiently track and manage its vast inventory of organic and natural products.
The system should provide real-time updates on stock levels to prevent overselling or
stockouts.
b. Enhanced Data Retrieval: Replace the manual data retrieval process from physical books
with a digital database system that allows quick and efficient data access. The system should
enable users to search, retrieve, and update information with ease.
c. Data Security and Integrity: Implement robust data security measures to safeguard
sensitive customer and business information. Ensure data integrity to prevent data corruption
or unauthorized modifications.
d. Real-time Inventory Updates: Enable real-time updates of inventory levels as products are
sold or restocked. This feature will provide accurate stock information and reduce the risk of
stockouts or overstocking.
e. User-friendly Interface: Design an intuitive and user-friendly interface that allows easy
navigation and data entry. The system should be accessible to non-technical users within the
organization.
By achieving these objectives, the project aims to empower Pure Petals with a modern and
efficient database management system, resulting in improved inventory management,
streamlined order processing, enhanced data security, and a more seamless and rewarding
customer experience.
1.4. TABLE DESCRIPTION :
CUSTOMER TABLE
The "CUSTOMER" table stores customer data, including CID (primary key), NAME, MAIL,
PHONE, CITY, COUNTRY, and PINCODE columns. It uniquely identifies each customer
using CID and ensures mandatory information is provided for NAME, PHONE, and
PINCODE.
SUPPLIER TABLE
The "SUPPLIER" table stores supplier data, including SID (primary key), S_NAME, S_MAIL,
S_PHONE, and S_CITY columns. It uniquely identifies each supplier using SID and ensures
mandatory information is provided for S_NAME and S_PHONE.
PRODUCT TABLE
The "PRODUCT" table stores product data, including PID (primary key), SID (foreign key
referencing SUPPLIER table), P_NAME, BRAND, PRICE, and STOCK columns. It ensures
data integrity by linking products to their respective suppliers (SID) and requires mandatory
information for P_NAME and STOCK.
ORDERS TABLE
The "ORDERS" table records order data, including OID (primary key), CID (foreign key
referencing CUSTOMER table), PID (foreign key referencing PRODUCT table), QTY, TAX,
and TOTAL columns. It ensures data integrity by linking orders to customers (CID) and
products (PID) and requires non-null values for QTY and TOTAL.
TRANSACTION TABLE
The "TRANSACTION" table stores transaction data, including TID (primary key), OID
(foreign key referencing ORDERS table), DELIVERY_STATUS, TRACKING_NO,
PAYMENT_MODE, P_DATE, and REVIEW columns. It ensures data integrity by linking
transactions to orders (OID) and requires a non-null value for the REVIEW.
2. NORMALIZATION
Normalisation refers to the database design process that aims to reduce data redundancy and
improve data integrity by organizing data into related tables. The process involves multiple
normal forms (e.g., 1NF, 2NF, 3NF) that address specific issues related to data redundancy and
dependency.
i. CUSTOMER Table
- CID (Primary Key)
- NAME
- MAIL
- PHONE
- CITY
- COUNTRY
- PINCODE
v. TRANSACTION Table
- TID (Primary Key)
- OID (Foreign Key, ORDERS table)
- DELIVERY_STATUS
- TRACKING_NO
- PAYMENT_MODE
- P_DATE
- REVIEW
CUSTOMER Table
Cardinality: One-to-Many (1:N)
Relationship: Each customer (CID) can place multiple orders, but each order is associated
with only one customer.
SUPPLIER Table
Cardinality: One-to-Many (1:N)
Relationship: Each supplier (SID) can supply multiple products, but each product is
associated with only one supplier.
PRODUCT Table
Cardinality: Many-to-One (N:1)
Relationship: Each product (PID) can be supplied by only one supplier, but each supplier can
supply multiple products.
ORDERS Table
Cardinality: Many-to-One (N:1) for both CUSTOMER and PRODUCT tables
Relationships: Each order (OID) is placed by one customer (CID), but each customer can
place multiple orders.
Each order (OID) contains details of one product (PID), but each product can be part of
multiple orders.
TRANSACTION Table:
Cardinality: One-to-One (1:1) with the ORDERS table
Relationship: Each transaction (TID) corresponds to one order (OID), and each order can
have only one associated transaction.
DDL is a subset of SQL used to define and manage the structure of a database,
including creating, altering, and deleting database objects like tables, indexes, and
constraints.
mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)
mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)
mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)
8. DATA INTEGRETY CONSTRAINS
8.1. PRIMARY KEY - Ensures uniqueness and identifies each row uniquely in a table.
CREATE :
INSERT :
CREATE :
INSERT :
mysql> INSERT INTO PRODUCT VALUES ('P01', 'S01', 'Organic Milk', 'Organic
Valley', 5, 100);
Query OK, 1 row affected (0.00 sec)
8.3. NOT NULL - Ensures that a column cannot have a null (empty) value.
CREATE :
INSERT :
mysql> INSERT INTO ORDERS VALUES ('O1001', 'C017', 'P11', 10, 2, 52, '2023-
09-01');
Query OK, 1 row affected (0.00 sec)
8.4. UNIQUE - Ensures that values in a column are unique across rows.
CREATE :
INSERT :
mysql> INSERT INTO TRANSACTION VALUES ('T01', 'O1001', 'In Transit', 1001,
'Cash on Delivery', '2023-09-05', 3);
Query OK, 1 row affected (0.00 sec)
8.5. CHECK - Defines conditions that must be met for data in a column.
CREATE :
INSERT :
Join operations in SQL combine rows from two or more tables based on a
related column between them, creating a result set that combines data from
multiple tables.
10.1 JOIN :