160 likes | 283 Views
Team D SQL Application for Business. Justin Perro Mike Hemara Thach. POS 410 SQL for Business Ashish Gulati. Business Description. Small startup business named JM Cellular.
E N D
Team DSQL Application for Business Justin Perro Mike Hemara Thach POS 410 SQL for Business AshishGulati
Business Description • Small startup business named JM Cellular. • JM business model consist of buying new, used cellular phones and Cellular services from reputable wholesale suppliers in Phoenix area and retail sells them to consumers at very comparative prices.
Problem Statement • Inventory Management • Employee Management • Queries
Inventory Management - Tracking • Unique by Inventory Number and Serial Number • Lookup Tables • Carrier • Suppliers • Manufacturer
Inventory Management - Transaction • Unique by Inventory Number and Serial Number • Foreign Keys • Transaction Type • Employee Id • Sales Price • Tax • Transactions Date
Inventory Management – Detail Tracking • Lookup Tables • Location • Manufacturer • Carrier • Supplier
Employee Management • Pertinent Employee information: • Name, Position, Address, Salary Type, Phone #’s etc. • Unique by Employee # • Foreign Key of Salary Type
Employee Management – Detail Tracking • Lookup Table • Salary Type • Unique Identifier • Choose Either: • Monthly • Weekly • Hourly --Salary Type CREATE TABLE dbo.tblSalaryType ( SalaryID SMALLINT Not Null, SalaryTypeDesc NVARCHAR (20) Not Null ------Monthly, Weekly, Hourly------ CONSTRAINT PK_UC_SalaryID PRIMARY KEY (SalaryID) ) GO
Employee Management – Salary • Tracks Hours worked and when • Foreign Key • EmpID • Unique Identifier • Composite Key • Date • Hours -- Employee Salary CREATE TABLE dbo.tblEmpSalary ( --EmpSalaryID SMALLINT NOT NULL, EmpID SMALLINT NOT NULL, CONSTRAINT FK_EmpSalary FOREIGN KEY (EmpID) REFERENCES dbo.tblEmployee(EmpID), EmpWorkHour Numeric(5,2) NOT NULL, EmpWorkDate Date NOT NULL DEFAULT GETDATE(), EmpComment NVARCHAR(200) NULL, CONSTRAINT PK_UC_EmpExpense PRIMARY KEY (EmpID,EmpWorkDate) ) GO
Query 1 Three way join to select all inventory items sold to date Displays Item Desc, PurPrice, Sale Price, Prof$, Prof%
Query 2 Two way join to group inventory items by carrier and compute costs by carrier Displays Carrier, Item Counts and Total Costs by carrier.
Query 3 Two way join to compute employee salaries, using case statement for salary types. Employee name,Workhrs, Salary, SalType, GrsPay, Ending Date.
Query 4 Three way join to select inventory items sold by employees Employee name, itemsold, PurPrice, Soldfor, Profit$