DBMSCourseProject A12 ComputerPeripheralsSalesAndServiceManagement ImplementationPhase
DBMSCourseProject A12 ComputerPeripheralsSalesAndServiceManagement ImplementationPhase
Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
11 61 29 43
Responsibilities: Anup V Shanbhag Chandragouda N C R Kavitha Sneha R S Creation of GUI and database connectivity. Data Entry And Preparation of the report. Normalization of Relational Schema. Modifying the ER Diagram.
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Design updating:
(CustomerID,FirstName,LastName,Gender,AddrStreet,AddrCity,AddrState,AddrZip,Contact, Email)
The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute. 2. supplier (SupplierID,Name,AddrStreet,AddrCity,AddrState,AddrZip,Contact,Email)
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute. 3. inventory (ProductID,ItemName,BrandName,Category,SupplierID,Units,PricePerUnit)
The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute. 4. sales(InvoiceID,CustomerID,NetAmount,Date,Status)
The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute. 5. servicereq (RequestID,CustomerID,Type,Description,RegdDate,Token)
The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute.
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 3 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
6. solditems (SerialID,ProductID,InvoiceID,Quantity,TotalPrice)
The Relation is in 1NF as it has no attributes that can hold only
multiple values. The attributes in the relation can hold only atomic values. The Relation is in 2NF as the primary key contains only one attribute. Hence, every attribute is fully functionally dependent on the key. We observe that there is no transitivity in functional dependencies for the given relation. Hence the relation is in 3NF. Similarly, It is in BCNF as there exists no non-key attribute that determines another non-key attribute. Question1: Give the SQL statement(s) used to create the Oracle/MySQL database tables needed to implement the normalized relational schema. Database Creation: CREATE DATABASE itdepot; USE itdepot; Customer: CREATE TABLE IF NOT EXISTS customer ( CustomerID int(11) NOT NULL, FirstName varchar(255) NOT NULL, LastName varchar(255) DEFAULT NULL, Gender varchar(255) NOT NULL, AddrStreet varchar(255) NOT NULL, AddrCity varchar(255) NOT NULL, AddrState varchar(255) NOT NULL, AddrZip int(11) NOT NULL, Contact varchar(11) NOT NULL, Email varchar(255) DEFAULT NULL, PRIMARY KEY (CustomerID), ); Supplier: CREATE TABLE IF NOT EXISTS supplier ( SupplierID int(11) NOT NULL, Name varchar(255) NOT NULL, AddrStreet varchar(255) NOT NULL, AddrCity varchar(255) NOT NULL, AddrState varchar(255) NOT NULL, AddrZip int(11) NOT NULL,
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 4 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Contact varchar(11) NOT NULL, Email varchar(255) DEFAULT NULL, PRIMARY KEY (SupplierID) ); Inventory: CREATE TABLE IF NOT EXISTS inventory ( ProductID int(11) NOT NULL, ItemName varchar(255) NOT NULL, BrandName varchar(255) DEFAULT NULL, Category varchar(255) NOT NULL, SupplierID int(11) NOT NULL, Units int(11) NOT NULL, PricePerUnit float NOT NULL, PRIMARY KEY (ProductID), FOREIGN KEY (SupplierID) REFERENCES supplier (SupplierID) ON UPDATE CASCADE ); Sales: CREATE TABLE IF NOT EXISTS sales ( InvoiceID int(11) NOT NULL, CustomerID int(11) NOT NULL, NetAmount float NOT NULL, Date date NOT NULL, Status varchar(255) NOT NULL, PRIMARY KEY (InvoiceID), FOREIGN KEY (CustomerID) REFERENCES customer (CustomerID) ON UPDATE CASCADE ); ServiceReq: CREATE TABLE IF NOT EXISTS servicereq ( RequestID int(11) NOT NULL, CustomerID int(11) NOT NULL, Type varchar(255) NOT NULL, Description varchar(255) DEFAULT NULL, RegdDate date NOT NULL, Token date DEFAULT NULL, PRIMARY KEY (RequestID), FOREIGN KEY (CustomerID) REFERENCES customer (CustomerID) ON UPDATE CASCADE ); SoldItems: CREATE TABLE IF NOT EXISTS solditems (
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 5 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
SerialID varchar(255) NOT NULL, ProductID int(11) NOT NULL, InvoiceID int(11) NOT NULL, Quantity int(11) NOT NULL, TotalPrice float NOT NULL, PRIMARY KEY (SerialID), FOREIGN KEY (ProductID) REFERENCES inventory (ProductID) ON UPDATE CASCADE, FOREIGN KEY (InvoiceID) REFERENCES sales (InvoiceID) ON UPDATE CASCADE, );
Question2: Give the actual data stored in each table of the database.
CustomerID 1 FirstName Anup LastName S Gender Male AddrStreet Rajnagar AddrCity Hubli AddrState Karnataka AddrZip 580032 Contact 944944168 4 988070770 6 973822332 9 959171872 6 959129997 9 E-Mail [email protected]
Vicky
Male
Ramnagar
Hubli
Karnataka
580029
Prateek
Male
Hubli
Karnataka
580031
Atreya
Male
Hubli
Karnataka
580029
Ashish
Male
Hubli
Karnataka
580021
ProductID 1 2 3 4
SupplierID 1 2 3 4
Units 5 10 5 5
Nvidia
Graphics Card
6800
SupplierI D 1
Name Seagate
AddrStreet Rajajinagar
AddrCity Bangalor e
AddrStat e Karnatak a
AddrZi p 560031
Contact 0802234656
E-Mail [email protected]
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
2 2 Transcen d Western Digital AMD Brigade Road J C Nagar Bangalor e Bangalor e Bangalor e Bangalor e Karnatak a Karnatak a Karnatak a Karnatak a 560029 0802265346 2 0802234466 2 0802278442 2 0806453120 2
[email protected] m [email protected]
560018
Koramangal a M G Road
560017
nVidia
560013
RequestID 1 2 3 4 5
CustomerID 1 2 3 4 5
Description Monitor Flickering OS Formatting Burnt smell from CPU Doesnt Turn On Black And White Video From Monitor
InvoiceID 1 2 3 4 5
CustomerID 1 2 3 4 5
SerialID ASD27654985AJ47
ProductID 1
InvoiceID 1
Quantity 1
TotalPrice 8500
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
2 3 4 5
2 3 4 5
1 1 1 1
Question3: Give the snapshots, description and SQL queries for each of the user interface forms for your application. (Create the front end using java and hook it up to the SQL using JDBC.) Login Form:
Customer Tab:
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
SQL Queries:
1. Load Values: SELECT * FROM customer; 2. Add Values: INSERT INTO customer VALUES( custID, firstName, lastName, gender, street, city,
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 9 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING state, zipCode, email, contact); 3. Save Updated Values: UPDATE customer SET FirstName= firstName, LastName= lastName, Gender= gender, AddrStreet= street, AddrCity= city, AddrState= state, AddrZip= zipCode, Contact= contact, Email= email WHERE CustomerID= custID; 4. Search Values:
SELECT * from customer where CustomerID= custID; SELECT * from customer where FirstName= firstName; SELECT * from customer where LastName= lastName; SELECT * from customer where Contact= contact;
Products Tab:
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
SQL Queries:
1. Load Values: SELECT * FROM inventory;
2. Add Values:
INSERT INTO inventory VALUES( prodID, prodName,
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 11 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING brandName, category, suplier, units, price);
4. Search Values
Case 1: SELECT * FROM inventory where ProductID= prodID; Case 2: SELECT * FROM inventory where ItemName= prodName; Case 3: SELECT * FROM inventory where Category= category; 5. Remove Values DELETE FROM inventory WHERE ProductID = prodID;
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Supplier Tab:
2. Add Values:
INSERT INTO supplier VALUES(supplierID, name, street , city, state,
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 13 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING zip, email, contact); 3. Save Updated Values: UPDATE supplier SET Name= name, AddrStreet= street , AddrCity= city , AddrState= state, AddrZip= zip, Contact= contact, Email= email WHERE SupplierID= supplierID; 4. Search Values:
Case 1: SELECT * FROM supplier where SupplierID= supplierID; Case 2: SELECT * FROM supplier where Name= name; Case 3: SELECT * FROM supplier where Contact= contact; 5. Remove Values: DELETE FROM supplier WHERE SupplierID = supplierID;
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Invoice Tab:
2. Add Values:
INSERT INTO sales VALUES(invoiceID, CustID, netAmt, Date, Status);
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 15 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
INSERT INTO solditems VALUES(serial, prodID, invID, qty, Price); 3. Save Updated Values: UPDATE sales SET CustomerID= CustID, NetAmount= netAmt, Date= Date, Status= Status WHERE InvoiceID= invoiceID );
4. Search Values:
Case 1: SELECT * FROM sales where InvoiceID= invoiceID; Case 2: SELECT * FROM sales where CustomerID= CustID;
5. Remove Values:
DELETE FROM sales WHERE InvoiceID = invoiceID;
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
SQL Queries:
1. Load Values:
SELECT * From servicereq;
2. Add Values:
INSERT INTO servicereq VALUES(requestID, customer, Type, Description, regDate, responseToken);
BVBCET/ISE/DBMS/ISC304/2012/Course Project/Implementation Phase/Page 17 of 19
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING 3. Save Updated Values: UPDATE servicereq SET Type= requestID, Description= Description, RegdDate= regDate, Token= responseToken WHERE RequestID= requestID); 4. Search Values:
Case 1: SELECT * FROM servicereq where RequestID= requestID; Case 2: SELECT * FROM servicereq where CustomerID= d _customer; 5. Remove Values: DELETE FROM servicereq WHERE RequestID = requestID;
K.L.E.Societys B.V.Bhoomaraddi College of Engineering & Technology, Hubli 580 031 DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
Question4: Give all possible final reports and graphs obtained by your application.