├── DBMS Retail Application
├── CSV Files
│ ├── Voucher.csv
│ ├── Product group.csv
│ ├── Supplier.csv
│ ├── Reviews.csv
│ ├── Zipcode.csv
│ ├── Product Details.csv
│ ├── Product.csv
│ ├── Employee.csv
│ ├── address.csv
│ ├── Bill.csv
│ ├── Order Product.csv
│ ├── Customer.csv
│ ├── Customer Fix.csv
│ ├── Orders.csv
│ ├── order.csv
│ ├── Employee New.csv
│ └── Payment.csv
├── EER3MFA.jpg
├── Result report.docx
├── DBMS Retail Application DatabaseMFA.pdf
├── README.md
├── SQLQueries,Triggers,StoredProcedures,Views.sql
└── SQL
│ └── Generated.SQL
├── README.md
└── Trial.R
/DBMS Retail Application/CSV Files/Voucher.csv:
--------------------------------------------------------------------------------
1 | Voucher_ID,Discount%
2 | V1,10
3 | V2,20
4 | V3,30
5 | V4,40
6 | V5,50
7 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Product group.csv:
--------------------------------------------------------------------------------
1 | Group_ID,Group_Name
2 | 100,Electronics
3 | 200,Clothing
4 | 300,Shoes
5 |
--------------------------------------------------------------------------------
/DBMS Retail Application/EER3MFA.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uppalapa/Database-Projects/HEAD/DBMS Retail Application/EER3MFA.jpg
--------------------------------------------------------------------------------
/DBMS Retail Application/Result report.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uppalapa/Database-Projects/HEAD/DBMS Retail Application/Result report.docx
--------------------------------------------------------------------------------
/DBMS Retail Application/DBMS Retail Application DatabaseMFA.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uppalapa/Database-Projects/HEAD/DBMS Retail Application/DBMS Retail Application DatabaseMFA.pdf
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Supplier.csv:
--------------------------------------------------------------------------------
1 | Supplier_ID,Supplier_Name,Supply_Quantity
2 | S001,Zara,200
3 | S002,Gucci,300
4 | S003,Lacoste,250
5 | S004,Nike,200
6 | S005,Addidas,300
7 | S006,Star,250
8 | S007,Apple,150
9 | S008,Lenevo,200
10 | S009,Hp,100
11 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Reviews.csv:
--------------------------------------------------------------------------------
1 | Quality_Rating,Defect%,Review_ID,Product_ID
2 | 7,10,RE01,PR101
3 | 7,10,RE02,PR102
4 | 7,10,RE03,PR103
5 | 7,10,RE04,PR104
6 | 7,10,RE05,PR105
7 | 7,10,RE06,PR106
8 | 7,10,RE07,PR107
9 | 9,0,RE08,PR108
10 | 9,0,RE09,PR109
11 | 9,0,RE10,PR110
12 | 9,0,RE11,PR111
13 | 9,0,RE12,PR112
14 | 9,0,RE13,PR113
15 | 9,0,RE14,PR114
16 | 9,0,RE15,PR115
17 | 9,0,RE16,PR116
18 | 9,0,RE17,PR117
19 | 7,10,RE18,PR118
20 | 7,10,RE19,PR119
21 | 7,10,RE20,PR120
22 | 7,10,RE21,PR121
23 | 7,10,RE22,PR122
24 | 7,10,RE23,PR123
25 | 7,10,RE24,PR124
26 | 7,10,RE25,PR125
27 | 7,10,RE26,PR126
28 | 7,10,RE27,PR127
29 | 7,10,RE28,PR128
30 | 8,5,RE29,PR129
31 | 8,5,RE30,PR130
32 | 8,5,RE31,PR131
33 | 8,5,RE32,PR132
34 | 8,4,RE33,PR133
35 | 8,4,RE34,PR134
36 | 9,0,RE35,PR135
37 | 9,0,RE36,PR136
38 | 5,20,RE37,PR137
39 | 4,30,RE38,PR138
40 | 9,0,RE39,PR139
41 | 9,0,RE40,PR140
42 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Zipcode.csv:
--------------------------------------------------------------------------------
1 | State,Zipcode_ID,City
2 | Florida,11000,Miami
3 | Florida,11001,Orlando
4 | Florida,11002,Tampa
5 | Florida,11003,Fort
6 | Florida,11004,Jacksonville
7 | Florida,11005,Key West
8 | Florida,11006,West Palm
9 | Florida,11007,Naples
10 | Florida,11008,St.Peterbrough
11 | Florida,11009,Daytona
12 | Alaska,22000,Anchorage
13 | Alaska,22001,Juneau
14 | Alaska,22002,Fair Banks
15 | Alaska,22003,Ketchikan
16 | Alaska,22004,Wasilla
17 | Alaska,22005,Sitka
18 | Alaska,22006,Kodiak
19 | Massachusetts,33000,Boston
20 | Massachusetts,33001,Framingham
21 | Massachusetts,33002,Somerville
22 | Massachusetts,33003,Playmouth
23 | Massachusetts,33004,Lowll
24 | Massachusetts,33005,Newton
25 | Massachusetts,33006,Quincy
26 | California,44000,Los Angeles
27 | California,44001,Sanfrancisco
28 | California,44002,Sandiego
29 | California,44003,San Jose
30 | Kansas,55000,Kansas City
31 | Kansas,55001,Topeka
32 | Kansas,55002,Wichida
33 | Kansas,55003,Over land
34 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Product Details.csv:
--------------------------------------------------------------------------------
1 | Product_ID,Weight,Width,Height,Colour
2 | PR101,8,15,13,White
3 | PR102,8,15,13,White
4 | PR103,8,15,12,Silver
5 | PR104,6,15,12,Silver
6 | PR105,6,13,12,Black
7 | PR106,6,13,12,Black
8 | PR107,6,13,12,Black
9 | PR108,4,11,12,Silver
10 | PR109,4,11,12,Silver
11 | PR110,4,11,12,Silver
12 | PR111,4,10,10,Silver
13 | PR112,3,1.8,6.8,Silver
14 | PR113,3,1.8,6.8,Black
15 | PR114,3,1.8,6.8,Black
16 | PR115,3,1.8,6.8,Black
17 | PR116,3,1.8,6.8,Black
18 | PR117,3,1.8,6.8,Black
19 | PR118,1,1.8,7.2,Rose Gold
20 | PR119,1,1.8,7.2,Rose Gold
21 | PR120,1,1.8,8,Rose Gold
22 | PR121,2,1.8,8.73,Black
23 | PR122,2,1.8,6.27,Black
24 | PR123,2,1.8,6.27,Black
25 | PR124,2,1.8,6.27,Black
26 | PR125,2,1.8,6.27,Black
27 | PR126,2,1.8,6.27,Black
28 | PR127,2,1.8,6.27,Black
29 | PR128,2,1.8,6.27,Black
30 | PR129,1,1.8,6.27,Black
31 | PR130,1,1.8,6.27,Black
32 | PR131,1,1.8,6.27,Black
33 | PR132,1,1.8,6.27,White
34 | PR133,1,1.8,6.27,Grey
35 | PR134,1,1.8,6.27,Grey
36 | PR135,1,1,10,Brown
37 | PR136,1,1,9,Black
38 | PR137,2,1,8,White
39 | PR138,2,1,7,Brown
40 | PR139,1,1,6,Black
41 | PR140,1,1,6,Brown
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Database Management for Retail Application
2 | * Designed a relational database schema using TOAD data modeler.
3 | * Created multiple tables and managed the retail stores’ data in MySQL.
4 | * Applied database objects like triggers, stored procedures, views, functions on the database.
5 | * Generated reports which helped the retail organization to evaluate their sales, analyze sales for this season and forecast sales for next season.
6 | * Used R for visuialization
7 |
8 | ### ER Diagram for Retail Application
9 | #### ER Diagram for Retail Application after Normalization
10 | 
11 |
12 | ### Data Vizualization using R
13 | 
14 | 
15 |
16 |
17 | ### Project README: README
18 | ### Project Link: PROJECT CODE
19 | ### Result Report: REPORT
20 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Product.csv:
--------------------------------------------------------------------------------
1 | Product_ID,Product_Name,Available_Number,Group_ID,Supplier_ID
2 | PR101,Lenevo Flex,25,100,S008
3 | PR102,Lenevo Yoga,25,100,S008
4 | PR103,Lenevo Think Pad,25,100,S008
5 | PR104,Mac Book Pro,27,100,S007
6 | PR105,Mac Mini,29,100,S007
7 | PR106,Mac Air,31,100,S007
8 | PR107,Mac Book,33,100,S007
9 | PR108,Mac Desktops,35,100,S007
10 | PR109,Hewlett Mini,37,100,S006
11 | PR110,Hewlett Desktop,39,100,S006
12 | PR111,Lenevo 5Note,40,100,S008
13 | PR112,Lenevo Phab,40,100,S008
14 | PR113,Lenevo A8,40,100,S008
15 | PR114,Lenevo K10,40,100,S008
16 | PR115,IphoneS7 Plus,40,100,S007
17 | PR116,IphoneS6 Plus,40,100,S007
18 | PR117,IphoneS4,21,100,S007
19 | PR118,IphoneS5,22,100,S007
20 | PR119,IphoneS6,23,100,S007
21 | PR120,IphoneS7,24,100,S007
22 | PR121,Zara Women Frocks,25,200,S002
23 | PR122,Zara Sweat Shirts,26,200,S002
24 | PR123,Zara Trousers,27,200,S002
25 | PR124,Zara Tshirt,28,200,S002
26 | PR125,Zara Hood Shirt,29,200,S002
27 | PR126,Gucci Sweat Shirt,30,200,S003
28 | PR127,Gucci Shirts,31,200,S003
29 | PR128,Gucci Women Frocks,32,200,S003
30 | PR129,Gucci Women Shirts,33,200,S003
31 | PR130,Gucci Men Tshirts,34,200,S003
32 | PR131,Gucci Women Tshirts,35,200,S003
33 | PR132,Lacoste Women Tshirts,22,200,S001
34 | PR133,Lacoste Mens Tshirts,22,200,S001
35 | PR134,Lacoste Shorts,22,200,S001
36 | PR135,Lacoste Shirts,17,200,S001
37 | PR136,Addidas Formal Shoes,18,300,S005
38 | PR137,Addidas sneakers,19,300,S005
39 | PR138,Nike Formal Shoes,20,300,S003
40 | PR139,Nike Sports Shoes,21,300,S003
41 | PR140,Star Sneakers,12,300,S001
42 |
--------------------------------------------------------------------------------
/Trial.R:
--------------------------------------------------------------------------------
1 | #Reading th csv File
2 | customer=read.csv("Customer Fix.csv")
3 |
4 | str(customer)
5 | summary(customer)
6 |
7 | ######remove coloumns
8 | customer = customer[-c( 2,3)]
9 | summary(customer)
10 | #########Plots#########
11 | #plot( table(customer$Customer_ID) , table(customer$Customer_Type) , xlab = "Customer" , ylab = "Customer type")
12 |
13 | ##Histogram
14 | #hist(customer$Customer_Type , xlab = "Customer_Type" ,ylab = "Frequency" , main = "Histogram of type of customer" )
15 | barplot(table(customer$Customer_Type))
16 |
17 | #install.packages("DMwR")
18 | library(DMwR)
19 | #install.packages("caret")
20 | library(caret)
21 | #install.packages("dplyr")
22 | library(dplyr)
23 | ### customer$Customer_ID <- as.factor(customer$Customer_ID)
24 |
25 | customer=customer[ -c(2,3,4,5) ]
26 | str(customer)
27 | summary(customer)
28 | preproc <- preProcess(customer)
29 | custNorm <- predict(preproc, customer)
30 | summary(custNorm)
31 | custNorm=scale(customer)
32 | summary(custNorm)
33 |
34 | set.seed(5000)
35 | clustKMC <- kmeans(custNorm, centers = 3)
36 |
37 | table(custKMC$cluster)
38 | install.packages("cluster")
39 | install.packages("fpc")
40 | library(fpc)
41 | library(cluster)
42 | plotcluster(custNorm, clustKMC$cluster)
43 | clusplot(custNorm, clustKMC$cluster, color=TRUE, shade=TRUE,
44 | labels=2, lines=0)
45 | normcluster1 <- subset(custNorm, custKMC$cluster == 1)
46 | summary(normcluster1)
47 | cluster1=unscale(normcluster1,custNorm)
48 | summary(cluster1)
49 |
50 | normcluster2 <- subset(custNorm, custKMC$cluster == 2)
51 | summary(normcluster2)
52 | cluster2=unscale(normcluster2,custNorm)
53 | summary(cluster2)
54 |
55 | normcluster3 <- subset(custNorm, custKMC$cluster == 3)
56 | summary(normcluster3)
57 | cluster3=unscale(normcluster3,custNorm)
58 | summary(cluster3)
59 |
60 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Employee.csv:
--------------------------------------------------------------------------------
1 | Designation,Department,Join_Date,ssn,Salary,Employee_ID,Employee_Name,Employee_Type
2 | Marketer,Marketing,2/12/2016,501965640,3000,E100,Mia,Full Time
3 | Sales Person,Sales,5/19/2016,448454504,1000,E101,Mia,Full Time
4 | Financial Advisor,Finance,10/21/2016,178408516,4000,E102,Mia,Full Time
5 | Business Analyst,Finance,8/18/2016,697367249,4000,E103,Mia,Full Time
6 | Accountant,Finance,1/18/2016,282314775,1200,E104,Mia,Full Time
7 | PC Assistants,Billing,3/10/2016,210794068,1300,E105,Mia,Full Time
8 | PC Assistants,Billing,11/25/2016,448101338,1300,E106,Mia,Full Time
9 | PC Assistants,Billing,11/5/2016,162274487,1300,E107,Leoni,Full Time
10 | PC Assistants,Billing,11/21/2016,583021048,1300,E108,Leoni,Full Time
11 | PC Assistants,Billing,5/4/2016,373888988,1300,E109,Leoni,Full Time
12 | PC Assistants,Billing,6/26/2016,432253711,1300,E110,Leoni,Full Time
13 | PC Assistants,Billing,5/14/2016,368292987,1300,E111,Leoni,Full Time
14 | PC Assistants,Billing,2/26/2016,759909891,1300,E112,Leoni,Full Time
15 | PC Assistants,Billing,11/29/2016,355492520,1300,E113,Marty,Full Time
16 | PC Assistants,Billing,8/19/2016,420485178,1300,E114,Marty,Full Time
17 | PC Assistants,Billing,1/8/2016,388145184,1300,E115,Marty,Full Time
18 | PC Assistants,Billing,11/18/2016,273173687,1300,E116,Bob,Full Time
19 | PC Assistants,Billing,4/10/2016,435797043,1300,E117,Bob,Full Time
20 | PC Assistants,Billing,4/22/2016,205203530,1300,E118,Bob,Full Time
21 | PC Assistants,Billing,1/31/2016,758165151,1300,E119,Bob,Part Time
22 | PC Assistants,Billing,7/1/2016,318277304,1300,E120,Peter,Part Time
23 | PC Assistants,Billing,4/12/2016,916118821,1300,E121,Peter,Part Time
24 | PC Assistants,Billing,9/16/2016,507645475,1300,E122,Joanna,Part Time
25 | Sales Advisor,Sales,4/27/2016,482702342,3000,E123,Joanna,Part Time
26 | Sales Advisor,Sales,8/19/2016,916799612,3000,E124,Visha,Part Time
27 | Sales Advisor,Sales,3/7/2016,552599525,3000,E125,Visha,Part Time
28 | Sales Advisor,Sales,7/26/2016,132527849,3000,E126,Ruby,Part Time
29 | Sales Person,Sales,12/7/2016,406234803,1000,E127,Ashley,Part Time
30 | Sales Person,Sales,5/2/2016,500963559,1000,E128,Stephanie,Part Time
31 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/address.csv:
--------------------------------------------------------------------------------
1 | Address_ID,Apartment_Number,Street,Apartment_Name,Customer_ID,,
2 | CA100,14,Tetlow,Emerald,10001,,1
3 | CA101,13,Palace Road,Emerald,10002,,
4 | CA102,18,New England,Emerald,10003,,3
5 | CA103,12,Brookline,Emerald,10004,,
6 | CA104,12,Heath Street,Emerald,10005,,
7 | CA105,20,Cambridge Road,Emerald,10006,,
8 | CA106,19,North West Avenue,Emerald,10007,,
9 | CA107,11,South West Ave,Westglow,10008,,
10 | CA108,17,Huntington Ave,Westglow,10009,,
11 | CA109,16,Indiana Street,Westglow,10010,,2
12 | CA110,11,Park Main,Westglow,10011,,
13 | CA111,20,Riddle Street,Westglow,10012,,
14 | CA112,13,Charles Street,Westglow,10013,,
15 | CA113,10,Hill Side,Gurnet,10014,,
16 | CA114,19,Clarks Hill,Gurnet,10015,,
17 | CA115,14,Mission Main,Gurnet,10016,,
18 | CA116,10,Hay Market,Gurnet,10017,,
19 | CA117,19,Masson Road,Gurnet,10018,,
20 | CA118,20,New Burn,Gurnet,10019,,
21 | CA119,16,Oak Ter,Gurnet,10000,,
22 | CA120,10,Oak Ter,Gurnet,20000,,
23 | CA121,19,Oak Ter,Oak Burn,20001,,
24 | CA122,11,Oak Ter,Oak Burn,20002,,
25 | CA123,19,Oak Ter,Oak Burn,20003,,
26 | CA124,11,Oak Ter,Oak Burn,20004,,
27 | CA125,17,Oak Ter,Oak Burn,20005,,
28 | CA126,13,Oak Ter,Oak Burn,20006,,
29 | CA127,14,Clarks Hill,Oak Burn,20007,,
30 | CA128,10,Clarks Hill,Mariposa,20008,,
31 | CA129,13,Clarks Hill,Mariposa,20009,,
32 | CA130,17,Clarks Hill,Mariposa,20010,,
33 | CA131,20,Clarks Hill,Mariposa,20011,,
34 | CA132,19,Clarks Hill,Mariposa,20012,,
35 | CA133,10,Clarks Hill,Mariposa,20013,,
36 | CA134,11,Clarks Hill,Mariposa,20014,,
37 | CA135,18,Clarks Hill,Mariposa,20015,,
38 | CA136,12,Clarks Hill,Mariposa,20016,,
39 | CA137,16,Charles Street,Mariposa,20017,,
40 | CA138,12,Charles Street,Mariposa,20018,,
41 | CA139,10,Charles Street,Harvester ,20019,,
42 | CA140,19,Charles Street,Harvester ,20020,,
43 | CA141,14,Charles Street,Harvester ,30000,,
44 | CA142,17,Charles Street,Harvester ,30001,,
45 | CA143,10,Charles Street,Harvester ,30002,,
46 | CA144,16,North West Avenue,Marcy,30003,,
47 | CA145,11,North West Avenue,Marcy,30004,,
48 | CA146,16,North West Avenue,Marcy,30005,,
49 | CA147,16,North West Avenue,Marcy,30006,,
50 | CA148,13,North West Avenue,Marcy,30007,,
51 | CA149,12,North West Avenue,Marcy,30008,,
52 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Bill.csv:
--------------------------------------------------------------------------------
1 | Billing_ID,Amount_Paid,Voucher_ID,Payment_ID,Order_ID
2 | B1000,2000,V5,P10,O100
3 | B1001,2000,V5,P11,O101
4 | B1002,2000,V5,P12,O102
5 | B1003,2000,V5,P13,O103
6 | B1004,1700,V5,P14,O104
7 | B1005,1700,V5,P15,O105
8 | B1006,1700,V5,P16,O106
9 | B1007,1700,V5,P17,O107
10 | B1008,1600,V5,P18,O108
11 | B1009,1600,V5,P19,O109
12 | B1010,1600,V5,P20,O110
13 | B1011,1600,V5,P21,O111
14 | B1012,1600,V5,P22,O112
15 | B1013,1600,V5,P23,O113
16 | B1014,1500,V4,P24,O114
17 | B1015,1500,V4,P25,O115
18 | B1016,1500,V4,P26,O116
19 | B1017,1500,V4,P27,O117
20 | B1018,1500,V4,P28,O118
21 | B1019,1500,V4,P29,O119
22 | B1020,1500,V4,P30,O120
23 | B1021,1200,V4,P31,O121
24 | B1022,1200,V4,P32,O122
25 | B1023,1200,V4,P33,O123
26 | B1024,1200,V4,P34,O124
27 | B1025,1200,V4,P35,O125
28 | B1026,1200,V4,P36,O126
29 | B1027,1000,V3,P37,O127
30 | B1028,1000,V3,P38,O128
31 | B1029,1000,V3,P39,O129
32 | B1030,1000,V3,P40,O130
33 | B1031,1000,V3,P41,O131
34 | B1032,1000,V3,P42,O132
35 | B1033,1000,V3,P43,O133
36 | B1034,1000,V3,P44,O134
37 | B1035,1000,V3,P45,O135
38 | B1036,1000,V3,P46,O136
39 | B1037,1000,V3,P47,O137
40 | B1038,1000,V3,P48,O138
41 | B1039,1000,V3,P49,O139
42 | B1040,1000,V3,P50,O140
43 | B1041,1000,V3,P51,O141
44 | B1042,1000,V3,P52,O142
45 | B1043,900,V3,P53,O143
46 | B1044,900,V3,P54,O144
47 | B1045,900,V3,P55,O145
48 | B1046,600,V2,P56,O146
49 | B1047,600,V2,P57,O147
50 | B1048,600,V2,P58,O148
51 | B1049,600,V2,P59,O149
52 | B1050,600,V2,P60,O150
53 | B1051,600,V2,P61,O151
54 | B1052,600,V2,P62,O152
55 | B1053,600,V2,P63,O153
56 | B1054,600,V2,P64,O154
57 | B1055,400,V2,P65,O155
58 | B1056,400,V2,P66,O156
59 | B1057,400,V2,P67,O157
60 | B1058,400,V2,P68,O158
61 | B1059,400,V2,P69,O159
62 | B1060,300,V1,P70,O160
63 | B1061,300,V1,P71,O161
64 | B1062,300,V1,P72,O162
65 | B1063,300,V1,P73,O163
66 | B1064,300,V1,P74,O164
67 | B1065,200,V1,P75,O165
68 | B1066,200,V1,P76,O166
69 | B1067,200,V1,P77,O167
70 | B1068,200,V1,P78,O168
71 | B1069,200,V1,P79,O169
72 | B1070,200,V1,P80,O170
73 | B1071,200,V1,P81,O171
74 | B1072,200,V1,P82,O172
75 | B1073,100,V1,P83,O173
76 | B1074,100,V1,P84,O174
77 | B1075,100,V1,P85,O175
78 | B1076,100,V1,P86,O176
79 | B1077,100,V1,P87,O177
80 | B1078,100,V1,P88,O178
81 | B1079,100,V1,P89,O179
82 | B1080,50,V1,P90,O180
83 | B1081,50,V1,P91,O181
84 | B1082,50,V1,P92,O182
85 | B1083,50,V1,P93,O183
86 | B1084,50,V1,P94,O184
87 | B1085,50,V1,P95,O185
88 | B1086,50,V1,P96,O186
89 | B1087,50,V1,P97,O187
90 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Order Product.csv:
--------------------------------------------------------------------------------
1 | Quantity,Product_ID,Order_ID,OrderProduct_ID
2 | 2,PR101,O100,OP01
3 | 1,PR101,O101,OP02
4 | 4,PR101,O102,OP03
5 | 1,PR104,O103,OP04
6 | 1,PR105,O104,OP05
7 | 1,PR106,O105,OP06
8 | 1,PR106,O106,OP07
9 | 4,PR106,O107,OP08
10 | 3,PR106,O108,OP09
11 | 5,PR106,O109,OP10
12 | 6,PR106,O110,OP11
13 | 3,PR112,O111,OP12
14 | 5,PR113,O112,OP13
15 | 3,PR114,O113,OP14
16 | 2,PR115,O114,OP15
17 | 2,PR116,O115,OP16
18 | 2,PR117,O116,OP17
19 | 2,PR118,O117,OP18
20 | 1,PR119,O118,OP19
21 | 4,PR120,O119,OP20
22 | 4,PR120,O120,OP21
23 | 4,PR120,O121,OP22
24 | 4,PR120,O122,OP23
25 | 4,PR124,O123,OP24
26 | 3,PR125,O124,OP25
27 | 3,PR126,O125,OP26
28 | 3,PR127,O126,OP27
29 | 3,PR128,O127,OP28
30 | 3,PR129,O128,OP29
31 | 5,PR130,O129,OP30
32 | 5,PR131,O130,OP31
33 | 5,PR132,O131,OP32
34 | 5,PR133,O132,OP33
35 | 5,PR134,O133,OP34
36 | 7,PR135,O134,OP35
37 | 5,PR136,O135,OP36
38 | 2,PR137,O136,OP37
39 | 2,PR138,O137,OP38
40 | 2,PR139,O138,OP39
41 | 2,PR140,O139,OP40
42 | 2,PR101,O140,OP41
43 | 2,PR101,O141,OP42
44 | 2,PR101,O142,OP43
45 | 2,PR101,O143,OP44
46 | 8,PR121,O144,OP45
47 | 4,PR121,O145,OP46
48 | 4,PR121,O146,OP47
49 | 4,PR121,O147,OP48
50 | 3,PR126,O148,OP49
51 | 3,PR127,O149,OP50
52 | 3,PR128,O150,OP51
53 | 6,PR109,O151,OP52
54 | 6,PR110,O152,OP53
55 | 6,PR111,O153,OP54
56 | 6,PR018,O154,OP55
57 | 3,PR019,O155,OP56
58 | 3,PR020,O156,OP57
59 | 3,PR021,O157,OP58
60 | 2,PR022,O158,OP59
61 | 2,PR023,O159,OP60
62 | 2,PR024,O160,OP61
63 | 2,PR025,O161,OP62
64 | 2,PR026,O162,OP63
65 | 5,PR027,O163,OP64
66 | 5,PR028,O164,OP65
67 | 5,PR029,O165,OP66
68 | 8,PR030,O166,OP67
69 | 8,PR031,O167,OP68
70 | 8,PR032,O168,OP69
71 | 9,PR033,O169,OP70
72 | 9,PR034,O170,OP71
73 | 9,PR035,O171,OP72
74 | 9,PR036,O172,OP73
75 | 9,PR037,O173,OP74
76 | 9,PR038,O174,OP75
77 | 9,PR039,O175,OP76
78 | 9,PR040,O176,OP77
79 | 9,PR041,O177,OP78
80 | 9,PR042,O178,OP79
81 | 9,PR043,O179,OP80
82 | 9,PR044,O180,OP81
83 | 9,PR045,O181,OP82
84 | 9,PR046,O182,OP83
85 | 9,PR047,O183,OP84
86 | 9,PR048,O184,OP85
87 | 9,PR049,O185,OP86
88 | 12,PR014,O186,OP87
89 | 12,PR015,O187,OP88
90 | 1,PR016,O178,OP89
91 | 1,PR017,O178,OP90
92 | 1,PR018,O178,OP91
93 | 1,PR019,O178,OP92
94 | 1,PR020,O178,OP93
95 | 1,PR021,O178,OP94
96 | 1,PR022,O178,OP95
97 | 1,PR033,O181,OP96
98 | 1,PR034,O182,OP97
99 | 1,PR035,O183,OP98
100 | 1,PR036,O184,OP99
101 | 1,PR037,O185,OP100
102 | 1,PR038,O186,OP101
103 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Customer.csv:
--------------------------------------------------------------------------------
1 | Customer_ID,First_Name,Last_Name,Phone_Number,Email_Address,Customer_Type
2 | 10000,kamala,Nayana,8576465699,nayana11@gmail.com,Student
3 | 10001,Nidhi,Mittal,8123457024,mittal11@gmail.com,Student
4 | 10002,Chandrika,Bolla,8123451709,bolla11@gmail.com,Student
5 | 10003,Gayathri,Maganti,8123546789,maganti11@gmail.com,Student
6 | 10004,Hithaishi,Avula,8987654321,avula11@gmail.com,Student
7 | 10005,Lahari,Palle,8120989767,palle1@gmail.com,Student
8 | 10006,Dheemanth,Uppalapati,8124366666,dhee11@gmail.com,Student
9 | 10007,Radha,Uppalapti,8127777777,ra11@gmail.com,Student
10 | 10008,Radha,Vallabhaneni,8177777772,radha11@gmail.com,Student
11 | 10009,Swarupa,kanaka,8777777712,swapu11@gmail.com,Student
12 | 10010,Anshika,Nunna,8101010102,anshi11@gmail.com,Student
13 | 10011,Avi,Pullela,8182818212,avi11@gmail.com,Student
14 | 10012,Keerthi,Kanakamedala,8272727212,keer11@gmail.com,Student
15 | 10013,Suresh,Kakarala,8292929212,suri11@gmail.com,Student
16 | 10014,Samba,Uppalapati,8129020932,samba11@gmail.com,Student
17 | 10015,Shruti,Ganji,8129302032,ganj11@gmail.com,Student
18 | 10016,Rahul,Samana,8116263742,sam11@gmail.com,Student
19 | 10017,Sindhu,Bhargavi,8199988892,sindh11@gmail.com,Student
20 | 10018,Harshith,Sahas,8190909092,harsh11@gmail.com,Student
21 | 10019,Sravya,Bobba,8909090912,srav11@gmail.com,Student
22 | 10020,Spoorthy,Kanamedala,8178787872,spoo11@gmail.com,Student
23 | 20000,Sita,Sree,8576460899,Sree11@gmail.com,Employee
24 | 20001,Nidhi,Mittal,8123456789,nm11@gmail.com,Employee
25 | 20002,Sandra,Meyer,8178780872,sandra00@gmail.com,Employee
26 | 20003,Laura,Meyer,8178780872,laura00@gmail.com,Employee
27 | 20004,Milly,George,8178780872,milly00@gmail.com,Employee
28 | 20005,Anna,Miller,8178780872,anna00@gmail.com,Employee
29 | 20006,Andy,Miller,8178780872,andy00@gmail.com,Employee
30 | 20007,Sandra,Bullock,8178780872,sandy00@gmail.com,Employee
31 | 20008,Stephne,Miller,8178780872,stephy00@gmail.com,Employee
32 | 20009,Lilly,Miller,8178780872,lilly00@gmail.com,Employee
33 | 20010,Roger,Mike,8178780872,roger00@gmail.com,Employee
34 | 20011,Andy,Blake,8178780872,blandy00@gmail.com,Employee
35 | 30000,John,Smith,8576400649,John11@gmail.com,Business
36 | 30001,Franklin,Roosevelt,987654321,roosevelt,Business
37 | 30002,Harry,Truman,987654312,harry123@gmail.com,Business
38 | 30003,Dwight,Eisenhower,987654313,Dwight@yahoo.com,Business
39 | 30004,John,Kennedy,987654314,Kennedy@yahoo.com,Business
40 | 30005,Lyndon,Johnson,987654315,Lyndon17@gmail.com,Business
41 | 30006,Richard,Nixon,987654361,nixon13@yahoo.com,Business
42 | 30007,Jimmy,Carter,987654317,carter12@yahoo.com,Business
43 | 30008,George,Bush,987654318,george@gmail.com,Business
44 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Customer Fix.csv:
--------------------------------------------------------------------------------
1 | Customer_ID,First_Name,Last_Name,Phone_Number,Email_Address,Customer_Type,Employee_ID
2 | 10000,kamala,Nayana,8576465699,nayana11@gmail.com,Student,E100
3 | 10001,Nidhi,Mittal,8123457024,mittal11@gmail.com,Student,E100
4 | 10002,Chandrika,Bolla,8123451709,bolla11@gmail.com,Student,E100
5 | 10003,Gayathri,Maganti,8123546789,maganti11@gmail.com,Student,E100
6 | 10004,Hithaishi,Avula,8987654321,avula11@gmail.com,Student,E106
7 | 10005,Lahari,Palle,8120989767,palle1@gmail.com,Student,E106
8 | 10006,Dheemanth,Uppalapati,8124366666,dhee11@gmail.com,Student,E106
9 | 10007,Radha,Uppalapti,8127777777,ra11@gmail.com,Student,E106
10 | 10008,Radha,Vallabhaneni,8177777772,radha11@gmail.com,Student,E106
11 | 10009,Swarupa,kanaka,8777777712,swapu11@gmail.com,Student,E106
12 | 10010,Anshika,Nunna,8101010102,anshi11@gmail.com,Student,E106
13 | 10011,Avi,Pullela,8182818212,avi11@gmail.com,Student,E107
14 | 10012,Keerthi,Kanakamedala,8272727212,keer11@gmail.com,Student,E107
15 | 10013,Suresh,Kakarala,8292929212,suri11@gmail.com,Student,E107
16 | 10014,Samba,Uppalapati,8129020932,samba11@gmail.com,Student,E112
17 | 10015,Shruti,Ganji,8129302032,ganj11@gmail.com,Student,E112
18 | 10016,Rahul,Samana,8116263742,sam11@gmail.com,Student,E112
19 | 10017,Sindhu,Bhargavi,8199988892,sindh11@gmail.com,Student,E112
20 | 10018,Harshith,Sahas,8190909092,harsh11@gmail.com,Student,E116
21 | 10019,Sravya,Bobba,8909090912,srav11@gmail.com,Student,E116
22 | 10020,Spoorthy,Kanamedala,8178787872,spoo11@gmail.com,Student,E116
23 | 20000,Sita,Sree,8576460899,Sree11@gmail.com,Employee,E120
24 | 20001,Nidhi,Mittal,8123456789,nm11@gmail.com,Employee,E120
25 | 20002,Sandra,Meyer,8178780872,sandra00@gmail.com,Employee,E120
26 | 20003,Laura,Meyer,8178780872,laura00@gmail.com,Employee,E120
27 | 20004,Milly,George,8178780872,milly00@gmail.com,Employee,E120
28 | 20005,Anna,Miller,8178780872,anna00@gmail.com,Employee,E119
29 | 20006,Andy,Miller,8178780872,andy00@gmail.com,Employee,E119
30 | 20007,Sandra,Bullock,8178780872,sandy00@gmail.com,Employee,E119
31 | 20008,Stephne,Miller,8178780872,stephy00@gmail.com,Employee,E109
32 | 20009,Lilly,Miller,8178780872,lilly00@gmail.com,Employee,E109
33 | 20010,Roger,Mike,8178780872,roger00@gmail.com,Employee,E109
34 | 20011,Andy,Blake,8178780872,blandy00@gmail.com,Employee,E118
35 | 30000,John,Smith,8576400649,John11@gmail.com,Business,E118
36 | 30001,Franklin,Roosevelt,987654321,roosevelt,Business,E118
37 | 30002,Harry,Truman,987654312,harry123@gmail.com,Business,E118
38 | 30003,Dwight,Eisenhower,987654313,Dwight@yahoo.com,Business,E118
39 | 30004,John,Kennedy,987654314,Kennedy@yahoo.com,Business,E118
40 | 30005,Lyndon,Johnson,987654315,Lyndon17@gmail.com,Business,E118
41 | 30006,Richard,Nixon,987654361,nixon13@yahoo.com,Business,E118
42 | 30007,Jimmy,Carter,987654317,carter12@yahoo.com,Business,E118
43 | 30008,George,Bush,987654318,george@gmail.com,Business,E118
44 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Orders.csv:
--------------------------------------------------------------------------------
1 | Order_ID,Order_Date,Status,Shippent_Duration,Payment_ID
2 | O100,3/22/2016,In Progress,Immediate,P10
3 | O101,11/15/2016,In Progress,Immediate,P11
4 | O102,8/23/2016,In Progress,Immediate,P12
5 | O103,2/18/2016,In Progress,Immediate,P13
6 | O104,9/10/2016,In Progress,Immediate,P14
7 | O105,5/24/2016,In Progress,Immediate,P15
8 | O106,4/3/2016,In Progress,Immediate,P16
9 | O107,7/10/2016,In Progress,Immediate,P17
10 | O108,11/8/2016,In Progress,Immediate,P18
11 | O109,7/21/2016,In Progress,Immediate,P19
12 | O110,10/27/2016,In Progress,Immediate,P20
13 | O111,5/6/2016,In Progress,Immediate,P21
14 | O112,4/21/2016,In Progress,Immediate,P22
15 | O113,8/20/2016,In Progress,Immediate,P23
16 | O114,4/14/2016,In Progress,Immediate,P24
17 | O115,4/2/2016,In Progress,Immediate,P25
18 | O116,10/31/2016,In Progress,Immediate,P26
19 | O117,7/4/2016,In Progress,Immediate,P27
20 | O118,4/19/2016,In Progress,Immediate,P28
21 | O119,5/1/2016,In Progress,With in 4 Days,P29
22 | O120,8/25/2016,In Progress,With in 4 Days,P30
23 | O121,1/17/2016,In Progress,With in 4 Days,P31
24 | O122,7/19/2016,In Progress,With in 4 Days,P32
25 | O123,5/21/2016,In Progress,With in 4 Days,P33
26 | O124,3/4/2016,In Progress,With in 4 Days,P34
27 | O125,11/6/2016,In Progress,With in 4 Days,P35
28 | O126,6/1/2016,In Progress,With in 4 Days,P36
29 | O127,5/18/2016,Shipped,With in 4 Days,P37
30 | O128,7/14/2016,Shipped,With in 4 Days,P38
31 | O129,8/25/2016,Shipped,With in 4 Days,P39
32 | O130,8/13/2016,Shipped,With in 4 Days,P40
33 | O131,12/26/2016,Shipped,With in 4 Days,P41
34 | O132,2/19/2016,Shipped,With in 4 Days,P42
35 | O133,1/20/2016,Shipped,With in 4 Days,P43
36 | O134,6/30/2016,Shipped,With in 4 Days,P44
37 | O135,2/12/2016,Shipped,With in 4 Days,P45
38 | O136,10/17/2016,Shipped,With in 4 Days,P46
39 | O137,7/18/2016,Shipped,With in 4 Days,P47
40 | O138,12/8/2016,Shipped,With in 4 Days,P48
41 | O139,6/11/2016,Shipped,With in 4 Days,P49
42 | O140,12/10/2016,Shipped,With in 4 Days,P50
43 | O141,10/7/2016,Shipped,With in 4 Days,P51
44 | O142,8/9/2016,Shipped,With in 4 Days,P52
45 | O143,10/22/2016,Shipped,With in 4 Days,P53
46 | O144,5/2/2016,Shipped,With in 4 Days,P54
47 | O145,12/23/2016,Shipped,With in 4 Days,P55
48 | O146,8/19/2016,Shipped,With in 4 Days,P56
49 | O147,12/17/2016,Shipped,With in 4 Days,P57
50 | O148,5/11/2016,Shipped,With in 4 Days,P58
51 | O149,6/27/2016,Shipped,With in 4 Days,P59
52 | O150,6/27/2016,Shipped,With in 4 Days,P60
53 | O151,4/14/2016,Shipped,With in 4 Days,P61
54 | O152,8/21/2016,Shipped,With in 4 Days,P62
55 | O153,6/14/2016,Shipped,With in 4 Days,P63
56 | O154,1/28/2016,Shipped,With in 4 Days,P64
57 | O155,6/8/2016,Shipped,With in 4 Days,P65
58 | O156,1/18/2016,Shipped,With in 4 Days,P66
59 | O157,6/24/2016,Shipped,With in 4 Days,P67
60 | O158,5/14/2016,Shipped,With in 1 Week,P68
61 | O159,12/9/2016,Shipped,With in 1 Week,P69
62 | O160,8/13/2016,Shipped,With in 1 Week,P70
63 | O161,3/19/2016,Shipped,With in 1 Week,P71
64 | O162,12/26/2016,Shipped,With in 1 Week,P72
65 | O163,9/27/2016,Shipped,With in 1 Week,P73
66 | O164,12/11/2016,Shipped,With in 1 Week,P74
67 | O165,7/21/2016,Shipped,With in 1 Week,P75
68 | O166,12/9/2016,Shipped,With in 1 Week,P76
69 | O167,3/10/2016,Shipped,With in 1 Week,P77
70 | O168,7/19/2016,Shipped,With in 1 Week,P78
71 | O169,8/9/2016,Shipped,With in 1 Week,P79
72 | O170,8/6/2016,Shipped,With in 1 Week,P80
73 | O171,6/8/2016,Shipped,With in 1 Week,P81
74 | O172,6/3/2016,Shipped,With in 1 Week,P82
75 | O173,4/29/2016,Partially Shipped,With in 1 Week,P83
76 | O174,4/17/2016,Partially Shipped,With in 1 Week,P84
77 | O175,7/27/2016,Partially Shipped,With in 1 Week,P85
78 | O176,7/7/2016,Partially Shipped,With in 1 Week,P86
79 | O177,9/8/2016,Partially Shipped,With in 1 Week,P87
80 | O178,5/4/2016,Partially Shipped,With in 1 Week,P88
81 | O179,1/20/2016,Partially Shipped,With in 1 Week,P89
82 | O180,7/20/2016,Partially Shipped,With in 1 Week,P90
83 | O181,8/3/2016,Partially Shipped,With in 1 Week,P91
84 | O182,7/25/2016,Partially Shipped,With in 1 Week,P92
85 | O183,4/23/2016,Partially Shipped,With in 1 Week,P93
86 | O184,11/27/2016,Partially Shipped,With in 1 Week,P94
87 | O185,12/17/2016,Partially Shipped,With in 1 Week,P95
88 | O186,1/24/2016,Partially Shipped,With in 1 Week,P96
89 | O187,3/4/2016,Partially Shipped,With in 1 Week,P97
90 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/order.csv:
--------------------------------------------------------------------------------
1 | Order_ID,Order_Date,Status,Shippent_Duration,Payment_ID
2 | O100,2/19/2016,In Progress,Immediate,P10
3 | O101,7/25/2016,In Progress,Immediate,P11
4 | O102,7/17/2016,In Progress,Immediate,P12
5 | O103,4/29/2016,In Progress,Immediate,P13
6 | O104,8/16/2016,In Progress,Immediate,P14
7 | O105,2/7/2016,In Progress,Immediate,P15
8 | O106,4/7/2016,In Progress,Immediate,P16
9 | O107,12/29/2016,In Progress,Immediate,P17
10 | O108,2/5/2016,In Progress,Immediate,P18
11 | O109,11/29/2016,In Progress,Immediate,P19
12 | O110,12/29/2016,In Progress,Immediate,P20
13 | O111,7/31/2016,In Progress,Immediate,P21
14 | O112,5/23/2016,In Progress,Immediate,P22
15 | O113,8/21/2016,In Progress,Immediate,P23
16 | O114,8/2/2016,In Progress,Immediate,P24
17 | O115,5/10/2016,In Progress,Immediate,P25
18 | O116,10/27/2016,In Progress,Immediate,P26
19 | O117,12/18/2016,In Progress,Immediate,P27
20 | O118,6/17/2016,In Progress,Immediate,P28
21 | O119,8/22/2016,In Progress,With in 4 Days,P29
22 | O120,11/9/2016,In Progress,With in 4 Days,P30
23 | O121,10/16/2016,In Progress,With in 4 Days,P31
24 | O122,12/21/2016,In Progress,With in 4 Days,P32
25 | O123,3/9/2016,In Progress,With in 4 Days,P33
26 | O124,4/12/2016,In Progress,With in 4 Days,P34
27 | O125,1/15/2016,In Progress,With in 4 Days,P35
28 | O126,7/9/2016,In Progress,With in 4 Days,P36
29 | O127,12/15/2016,Shipped,With in 4 Days,P37
30 | O128,7/18/2016,Shipped,With in 4 Days,P38
31 | O129,3/13/2016,Shipped,With in 4 Days,P39
32 | O130,6/12/2016,Shipped,With in 4 Days,P40
33 | O131,3/26/2016,Shipped,With in 4 Days,P41
34 | O132,4/23/2016,Shipped,With in 4 Days,P42
35 | O133,9/19/2016,Shipped,With in 4 Days,P43
36 | O134,6/25/2016,Shipped,With in 4 Days,P44
37 | O135,2/29/2016,Shipped,With in 4 Days,P45
38 | O136,8/24/2016,Shipped,With in 4 Days,P46
39 | O137,7/30/2016,Shipped,With in 4 Days,P47
40 | O138,10/21/2016,Shipped,With in 4 Days,P48
41 | O139,3/7/2016,Shipped,With in 4 Days,P49
42 | O140,5/16/2016,Shipped,With in 4 Days,P50
43 | O141,6/3/2016,Shipped,With in 4 Days,P51
44 | O142,2/2/2016,Shipped,With in 4 Days,P52
45 | O143,1/11/2016,Shipped,With in 4 Days,P53
46 | O144,5/31/2016,Shipped,With in 4 Days,P54
47 | O145,2/29/2016,Shipped,With in 4 Days,P55
48 | O146,11/2/2016,Shipped,With in 4 Days,P56
49 | O147,12/26/2016,Shipped,With in 4 Days,P57
50 | O148,11/13/2016,Shipped,With in 4 Days,P58
51 | O149,12/27/2016,Shipped,With in 4 Days,P59
52 | O150,1/19/2016,Shipped,With in 4 Days,P60
53 | O151,4/8/2016,Shipped,With in 4 Days,P61
54 | O152,12/9/2016,Shipped,With in 4 Days,P62
55 | O153,10/27/2016,Shipped,With in 4 Days,P63
56 | O154,12/6/2016,Shipped,With in 4 Days,P64
57 | O155,11/28/2016,Shipped,With in 4 Days,P65
58 | O156,10/11/2016,Shipped,With in 4 Days,P66
59 | O157,2/4/2016,Shipped,With in 4 Days,P67
60 | O158,9/26/2016,Shipped,With in 1 Week,P68
61 | O159,3/9/2016,Shipped,With in 1 Week,P69
62 | O160,12/30/2016,Shipped,With in 1 Week,P70
63 | O161,11/16/2016,Shipped,With in 1 Week,P71
64 | O162,1/13/2016,Shipped,With in 1 Week,P72
65 | O163,8/24/2016,Shipped,With in 1 Week,P73
66 | O164,6/23/2016,Shipped,With in 1 Week,P74
67 | O165,9/14/2016,Shipped,With in 1 Week,P75
68 | O166,8/10/2016,Shipped,With in 1 Week,P76
69 | O167,11/20/2016,Shipped,With in 1 Week,P77
70 | O168,4/11/2016,Shipped,With in 1 Week,P78
71 | O169,11/27/2016,Shipped,With in 1 Week,P79
72 | O170,4/9/2016,Shipped,With in 1 Week,P80
73 | O171,6/23/2016,Shipped,With in 1 Week,P81
74 | O172,8/17/2016,Shipped,With in 1 Week,P82
75 | O173,8/9/2016,Partially Shipped,With in 1 Week,P83
76 | O174,7/15/2016,Partially Shipped,With in 1 Week,P84
77 | O175,7/28/2016,Partially Shipped,With in 1 Week,P85
78 | O176,2/21/2016,Partially Shipped,With in 1 Week,P86
79 | O177,8/3/2016,Partially Shipped,With in 1 Week,P87
80 | O178,2/21/2016,Partially Shipped,With in 1 Week,P88
81 | O179,10/21/2016,Partially Shipped,With in 1 Week,P89
82 | O180,5/7/2016,Partially Shipped,With in 1 Week,P90
83 | O181,6/23/2016,Partially Shipped,With in 1 Week,P91
84 | O182,3/24/2016,Partially Shipped,With in 1 Week,P92
85 | O183,3/20/2016,Partially Shipped,With in 1 Week,P93
86 | O184,7/14/2016,Partially Shipped,With in 1 Week,P94
87 | O185,2/13/2016,Partially Shipped,With in 1 Week,P95
88 | O186,12/17/2016,Partially Shipped,With in 1 Week,P96
89 | O187,12/14/2016,Partially Shipped,With in 1 Week,P97
90 |
--------------------------------------------------------------------------------
/DBMS Retail Application/README.md:
--------------------------------------------------------------------------------
1 | # Database Management for Retail Application
2 | ### Problem Statement:
3 | * A Retail business organization (target) is not able to handle and maintain the details of potential market.
4 | * It is unable to manage various employees who belong to various departments, information about the customers and sold products their defects, quality and Voucher details etc.
5 | ### Scope of Project:
6 | * This project aims to build a database for retail application for an organization like Target where customers buy projects online and offline.
7 | * Retail application database is mainly used by the retail store administrators to improve their sales by analyze the product sales, customer and employees working in their organization
8 | * This project helps in designing unique database which holds the information of the business model to properly store, analyze the data that company is looking for
9 | * Products list with minimum defects and maximum quality can be know which helps the organization to maintain good quality products in their store and increase their sales
10 | * This project helps the organization to store and analyze customers, employee, product sales details.
11 | * This Database design helps in analyzing which product is highly rated by customers, Total revenue earned by online and offline payment modes.
12 | ### Identification of Entities:
13 | * Employee
14 | * Customer
15 | * Address
16 | * Zip Code
17 | * Bill
18 | * Payment Mode
19 | * Order
20 | * Order Item
21 | * Order Product
22 | * Product
23 | * Voucher
24 | * Product Group
25 | * Product Description
26 | * Reviews
27 |
28 | ⇾ Employee-Any person who is employed as a part of company staff
29 | Attributes: EmployeeID, EmpFirst_Name, EmpLast_SSN, EmpMail_Address, Designation, Department, Salary, Employee_Type.
30 |
31 | ⇾ Customer -A person who buys products with cash or card basis. He may be internal or external customer.
32 | Attributes: CustomerID, First_Name, Last_Name, Mail_Address, Phone_Number, Category
33 |
34 | ⇾ Bill -Bill includes the total bill for the purchased products and amount that customer paid
35 | Attributes: Billing_ID, Amount_Paid
36 |
37 | ⇾ Address -Address to with a particular order must be delivered.
38 | Attributes: AddressID, Address_line1, Address_line2
39 |
40 | ⇾ Zip Code -Zip details of customers address is included
41 | Attributes: ZipCode, City, State
42 |
43 | ⇾ Payment- This table hold Date of customer visit number, payment and payment type whether the customer bought directly from store or purchased online. It also includes the customer card details
44 | Attributes: Payment_ID, Payment_Type, CreditCard_Number,Card_Type, CVV_Number, ExpiryDate, CardHolder_Name
45 |
46 | ⇾ Orders – This table hold the status of the order whether the order is delivered or not and the shipment option given by the customer.
47 | Attributes: Order_ID,Shippment_Duration, Order_Date,Status.
48 |
49 | ⇾ Order Item-OrderItem contains the details like date and quantity of items purchased.
50 | Attributes: Date of Order, Quantity
51 |
52 | ⇾ Order Product- This contains the details of quantity of product that customer ordered
53 | Attributes: OrderProduct_ID, Quantity
54 |
55 | ⇾ Voucher- Voucher includes priority of customers so based on that customers are given discount on their purchase.
56 | Attributes: Voucher_Number, Description, Priority, Quantity_Item
57 |
58 | ⇾ Product -It is a form of good that is purchased by customer.
59 | Attributes: ProductID, Product_Name, Available_Number
60 |
61 | ⇾ Product Details – Product details contains the description of particular product
62 | Attributes: Weight, Width, Colour, Height
63 |
64 | ⇾ Product Group – Product group tells to which category the product belongs to (Ex. Electronics)
65 | Attributes: Group_ID, Group_Name
66 |
67 | ⇾ Review-Reviews are the feedback given to the product by customers.
68 | Attributes: Quality, Defect%, Review_ID, Review_Date
69 |
70 | ### ER Diagram for Retail Application
71 | #### ER Diagram for Retail Application Before Normalization:
72 | 
73 | 
74 |
75 | #### After Normalization
76 | 
77 |
78 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Employee New.csv:
--------------------------------------------------------------------------------
1 | Payment_ID,Payment_Mode,Card_Type,Card_Number,CVV,Name_On_Card,Customer_ID,Visit_Number,Employee_ID
2 | P10,online,credit,2637231147,259,Tom,10001,1,E100
3 | P11,online,debit,2314090152,628,Robert,10002,1,E100
4 | P12,online,debit,3160466116,750,Sandra,10002,2,E100
5 | P13,online,debit,1924770950,643,Meyer,10002,3,E100
6 | P14,online,debit,2605710031,348,Laura,10002,4,E100
7 | P15,online,debit,1760861438,372,Paul,10002,5,E101
8 | P16,online,debit,2486382462,821,Stephen,10002,6,E101
9 | P17,online,debit,2026172246,573,Richard,10002,7,E102
10 | P18,online,debit,1652325458,664,Danie,10002,8,E102
11 | P19,online,debit,1593155579,527,Danie,10003,1,E104
12 | P20,online,debit,3600749836,366,Danie,10003,2,E104
13 | P21,online,debit,1629603244,331,Danie,10003,3,E104
14 | P22,online,credit,2196257042,497,Danie,10003,4,E104
15 | P23,online,credit,3176037606,699,Danie,10003,5,E104
16 | P24,online,credit,4227850650,867,Danie,10003,6,E104
17 | P25,online,credit,1922366282,870,Danie,10005,1,E104
18 | P26,online,credit,4290419995,890,Danie,10006,1,E104
19 | P27,online,credit,1831996471,268,Paul,10006,2,E104
20 | P28,online,credit,2394100413,417,Paul,10006,3,E104
21 | P29,online,credit,1127802595,488,Paul,10006,4,E115
22 | P30,online,credit,3211572399,599,Paul,10006,5,E115
23 | P31,online,credit,3754477702,376,Paul,10007,1,E115
24 | P32,online,credit,4332207305,283,Paul,10007,2,E115
25 | P33,online,credit,1370698763,642,Paul,10007,3,E115
26 | P34,online,credit,3046243391,150,Paul,10007,4,E115
27 | P35,online,debit,2145277261,644,Paul,10007,5,E115
28 | P36,online,debit,1427358687,815,Paul,10007,6,E115
29 | P37,online,debit,3879003240,704,Paul,10007,7,E115
30 | P38,online,debit,1494504380,518,Mike,10007,8,E115
31 | P39,online,debit,1513724846,471,Mike,10007,9,E115
32 | P40,online,debit,1150749080,659,Mike,10007,10,E115
33 | P41,online,debit,2021084797,490,Mike,10008,1,E115
34 | P42,online,debit,2583687271,846,Mike,10008,2,E115
35 | P43,online,debit,2643425696,265,Mike,10008,3,E115
36 | P44,direct,debit,1627922960,258,Mike,10009,1,E116
37 | P45,direct,debit,3349298033,660,Mike,10009,2,E116
38 | P46,direct,debit,2556226002,517,Mike,10009,3,E116
39 | P47,direct,debit,2122858396,441,Mike,10009,4,E116
40 | P48,direct,debit,4327209833,326,Mike,10009,5,E116
41 | P49,direct,credit,3216903325,487,Mike,10009,6,E116
42 | P50,direct,credit,1819229414,813,Mike,10009,7,E116
43 | P51,direct,credit,2751033800,882,Mike,10009,8,E117
44 | P52,direct,credit,1641183774,308,Mike,10009,9,E116
45 | P53,direct,credit,1194550010,350,Mike,10010,1,E117
46 | P54,direct,credit,1408194222,377,Esteller,10010,2,E117
47 | P55,direct,credit,1342371996,318,Esteller,10010,3,E117
48 | P56,direct,credit,3259865998,562,Esteller,10010,4,E117
49 | P57,direct,credit,4198907218,691,Esteller,10010,5,E117
50 | P58,direct,credit,1253548883,134,Esteller,10011,1,E117
51 | P59,direct,credit,2769503830,288,Esteller,10012,1,E117
52 | P60,direct,credit,4111052432,774,Esteller,10013,1,E119
53 | P61,direct,credit,2733430220,310,Esteller,10014,1,E119
54 | P62,direct,credit,1481583127,206,Esteller,10015,1,E118
55 | P63,direct,credit,1754015666,590,Esteller,10016,1,E118
56 | P64,direct,credit,4327697062,143,Esteller,10017,1,E108
57 | P65,direct,credit,2776996454,445,Esteller,10018,1,E108
58 | P66,direct,credit,1508118285,102,Esteller,10019,1,E108
59 | P67,direct,credit,3613558356,618,Sandra,10020,1,E108
60 | P68,direct,credit,1377075209,387,Sandra,20000,1,E108
61 | P69,direct,credit,1775034267,308,Sandra,20001,1,E108
62 | P70,direct,credit,1086781067,817,Sandra,20002,1,E108
63 | P71,direct,credit,4289402597,398,Sandra,20003,1,E108
64 | P72,direct,credit,1867595319,166,Sandra,20004,1,E108
65 | P73,direct,credit,2153326098,334,Sandra,20005,1,E108
66 | P74,direct,credit,2287425122,767,Sandra,20006,1,E112
67 | P75,direct,credit,3153569739,796,Sandra,20007,1,E112
68 | P76,direct,credit,2907204337,378,Sandra,20008,1,E112
69 | P77,direct,credit,3379971129,610,Adam,20009,1,E112
70 | P78,direct,credit,3559421590,516,Adam,20010,1,E112
71 | P79,direct,credit,4068575013,848,Adam,20011,1,E113
72 | P89,direct,credit,2740985596,114,Robert,30000,1,E113
73 | P90,direct,credit,4209354840,880,Robert,30001,1,E113
74 | P91,direct,credit,1903101101,552,Robert,30002,1,E113
75 | P92,direct,credit,1022378637,861,Robert,30003,1,E114
76 | P93,direct,credit,3940621897,596,Robert,30004,1,E114
77 | P94,direct,credit,1793626701,885,Robert,30005,1,E114
78 | P95,direct,credit,1936844809,677,Robert,30006,1,E114
79 | P96,direct,credit,1121240227,433,Robert,30007,1,E114
80 | P97,direct,credit,4160078849,842,Robert,30008,1,E114
81 |
--------------------------------------------------------------------------------
/DBMS Retail Application/CSV Files/Payment.csv:
--------------------------------------------------------------------------------
1 | Payment_ID,Payment_Mode,Card_Type,Card_Number,CVV,Name_On_Card,Customer_ID,Visit_Number
2 | P10,online,credit,2637231147,259,Tom,10001,1
3 | P11,online,debit,2314090152,628,Robert,10002,1
4 | P12,online,debit,3160466116,750,Sandra,10002,2
5 | P13,online,debit,1924770950,643,Meyer,10002,3
6 | P14,online,debit,2605710031,348,Laura,10002,4
7 | P15,online,debit,1760861438,372,Paul,10002,5
8 | P16,online,debit,2486382462,821,Stephen,10002,6
9 | P17,online,debit,2026172246,573,Richard,10002,7
10 | P18,online,debit,1652325458,664,Danie,10002,8
11 | P19,online,debit,1593155579,527,Danie,10003,1
12 | P20,online,debit,3600749836,366,Danie,10003,2
13 | P21,online,debit,1629603244,331,Danie,10003,3
14 | P22,online,credit,2196257042,497,Danie,10003,4
15 | P23,online,credit,3176037606,699,Danie,10003,5
16 | P24,online,credit,4227850650,867,Danie,10003,6
17 | P25,online,credit,1922366282,870,Danie,10005,1
18 | P26,online,credit,4290419995,890,Danie,10006,1
19 | P27,online,credit,1831996471,268,Paul,10006,2
20 | P28,online,credit,2394100413,417,Paul,10006,3
21 | P29,online,credit,1127802595,488,Paul,10006,4
22 | P30,online,credit,3211572399,599,Paul,10006,5
23 | P31,online,credit,3754477702,376,Paul,10007,1
24 | P32,online,credit,4332207305,283,Paul,10007,2
25 | P33,online,credit,1370698763,642,Paul,10007,3
26 | P34,online,credit,3046243391,150,Paul,10007,4
27 | P35,online,debit,2145277261,644,Paul,10007,5
28 | P36,online,debit,1427358687,815,Paul,10007,6
29 | P37,online,debit,3879003240,704,Paul,10007,7
30 | P38,online,debit,1494504380,518,Mike,10007,8
31 | P39,online,debit,1513724846,471,Mike,10007,9
32 | P40,online,debit,1150749080,659,Mike,10007,10
33 | P41,online,debit,2021084797,490,Mike,10008,1
34 | P42,online,debit,2583687271,846,Mike,10008,2
35 | P43,online,debit,2643425696,265,Mike,10008,3
36 | P44,direct,debit,1627922960,258,Mike,10009,1
37 | P45,direct,debit,3349298033,660,Mike,10009,2
38 | P46,direct,debit,2556226002,517,Mike,10009,3
39 | P47,direct,debit,2122858396,441,Mike,10009,4
40 | P48,direct,debit,4327209833,326,Mike,10009,5
41 | P49,direct,credit,3216903325,487,Mike,10009,6
42 | P50,direct,credit,1819229414,813,Mike,10009,7
43 | P51,direct,credit,2751033800,882,Mike,10009,8
44 | P52,direct,credit,1641183774,308,Mike,10009,9
45 | P53,direct,credit,1194550010,350,Mike,10010,1
46 | P54,direct,credit,1408194222,377,Esteller,10010,2
47 | P55,direct,credit,1342371996,318,Esteller,10010,3
48 | P56,direct,credit,3259865998,562,Esteller,10010,4
49 | P57,direct,credit,4198907218,691,Esteller,10010,5
50 | P58,direct,credit,1253548883,134,Esteller,10011,1
51 | P59,direct,credit,2769503830,288,Esteller,10012,1
52 | P60,direct,credit,4111052432,774,Esteller,10013,1
53 | P61,direct,credit,2733430220,310,Esteller,10014,1
54 | P62,direct,credit,1481583127,206,Esteller,10015,1
55 | P63,direct,credit,1754015666,590,Esteller,10016,1
56 | P64,direct,credit,4327697062,143,Esteller,10017,1
57 | P65,direct,credit,2776996454,445,Esteller,10018,1
58 | P66,direct,credit,1508118285,102,Esteller,10019,1
59 | P67,direct,credit,3613558356,618,Sandra,10020,1
60 | P68,direct,credit,1377075209,387,Sandra,20000,1
61 | P69,direct,credit,1775034267,308,Sandra,20001,1
62 | P70,direct,credit,1086781067,817,Sandra,20002,1
63 | P71,direct,credit,4289402597,398,Sandra,20003,1
64 | P72,direct,credit,1867595319,166,Sandra,20004,1
65 | P73,direct,credit,2153326098,334,Sandra,20005,1
66 | P74,direct,credit,2287425122,767,Sandra,20006,1
67 | P75,direct,credit,3153569739,796,Sandra,20007,1
68 | P76,direct,credit,2907204337,378,Sandra,20008,1
69 | P77,direct,credit,3379971129,610,Adam,20009,1
70 | P78,direct,credit,3559421590,516,Adam,20010,1
71 | P79,direct,credit,4068575013,848,Adam,20011,1
72 | P80,direct,credit,1461189748,684,Adam,20012,1
73 | P81,direct,credit,1603218647,441,Adam,20013,1
74 | P82,direct,credit,3698423753,448,Adam,20014,1
75 | P83,direct,credit,4352973259,652,Adam,20015,1
76 | P84,direct,credit,2060023961,848,Adam,20016,1
77 | P85,direct,credit,1490287836,319,Robert,20017,1
78 | P86,direct,credit,1528160762,455,Robert,20018,1
79 | P87,direct,credit,2465051294,269,Robert,20019,1
80 | P88,direct,credit,1725024863,837,Robert,20020,1
81 | P89,direct,credit,2740985596,114,Robert,30000,1
82 | P90,direct,credit,4209354840,880,Robert,30001,1
83 | P91,direct,credit,1903101101,552,Robert,30002,1
84 | P92,direct,credit,1022378637,861,Robert,30003,1
85 | P93,direct,credit,3940621897,596,Robert,30004,1
86 | P94,direct,credit,1793626701,885,Robert,30005,1
87 | P95,direct,credit,1936844809,677,Robert,30006,1
88 | P96,direct,credit,1121240227,433,Robert,30007,1
89 | P97,direct,credit,4160078849,842,Robert,30008,1
90 |
--------------------------------------------------------------------------------
/DBMS Retail Application/SQLQueries,Triggers,StoredProcedures,Views.sql:
--------------------------------------------------------------------------------
1 | --QUERIES
2 | ____________________________________________________________________________________________________________________________________________________________________
3 | --Query1
4 | --Find how many customers are there group by category
5 |
6 | SELECT Customer_Type, count(Customer_Type) as Total
7 | FROM anra.customer
8 | GROUP BY Customer_Type;
9 |
10 | --Query2
11 | --Find 2 appartments whose name is emerald or their id is 11003
12 | SELECT Address_ID, Appartment_Name, Zipcode_ID
13 | FROM anra.address
14 | WHERE (Appartment_Name= 'Emerald' OR Zipcode_ID = '11003')
15 | ORDER BY Zipcode_ID DESC
16 | Limit 2;
17 |
18 | --Query3
19 | --Find the supplied product count and their group for each product
20 |
21 | select anra.supplier.Supplier_ID,anra.supplier.Supplier_Name, Count(anra.product.Group_ID) AS `Product Count`, anra.`product group`.Group_Name
22 | from
23 | anra.supplier
24 | inner join
25 | anra.product
26 | on anra.supplier.Supplier_ID=anra.product.Supplier_ID
27 | inner join
28 | anra.`product group`
29 | on anra.product.Group_ID=anra.`product group`.Group_ID
30 |
31 | Group by Supplier_ID Asc
32 |
33 | --Query4
34 | --Total number of orders to be shipped immediate and is partially Shipped
35 |
36 | SELECT Order_ID, Order_Date,`Status`,count(Order_ID) as Total
37 | FROM anra.orders
38 | WHERE (Shippent_Duration= 'Immediate' and`Status`='Partially Shipped')
39 | ORDER BY Order_ID DESC;
40 |
41 | --Query5
42 | --List of products by department which has high defect%
43 |
44 | SELECT anra.reviews.Product_ID,anra.product.Product_Name,
45 | MAX(anra.reviews.`Defect%`) As `Defect%`, anra.`product group`.Group_Name
46 | from
47 | anra.reviews
48 | inner join
49 | anra.product
50 | on anra.reviews.Product_ID=anra.product.Product_ID
51 | inner join
52 | anra.`product group`
53 | on anra.product.Group_ID=anra.`product group`.Group_ID
54 | Group by `product group`.Group_ID
55 |
56 | --Query6
57 | --Total amount of revenue earned with respect to their purchasing modes
58 |
59 | Select count(Payment_Mode) As Total_Cutomers, anra.payment.Payment_Mode,Sum(anra.bill.Amount_Paid)
60 | As Total_Amount
61 | from anra.payment
62 | inner join
63 | anra.bill
64 | on anra.payment.Payment_ID=anra.bill.Payment_ID
65 | group by Payment_Mode
66 |
67 |
68 |
69 | --Query7
70 | --Find The quantity of products available whose status is in progress and shipment duration is immediate
71 |
72 |
73 | SELECT anra.product.Product_Name,anra.product.Available_Number,`order product`.Quantity,orders.Order_Date, orders.`Status`,orders.Shippent_Duration
74 | from
75 | anra.orders
76 | inner join
77 | anra.`order product`
78 | on anra.orders.Order_ID=anra.`order product`.Order_ID
79 | inner join
80 | anra.product
81 | on anra.`order product`.Product_ID=anra.product.Product_ID
82 | where
83 | orders.`Status`='In Progress' and orders.Shippent_Duration='Immediate';
84 |
85 | --Query8
86 | --Find the names and defect% order by defect%
87 | SELECT Product_Name,`Defect%`
88 | FROM anra.product
89 | INNER JOIN anra.reviews
90 | ON anra.reviews.Product_ID=anra.product.Product_ID
91 | ORDER BY `Defect%` Desc;
92 |
93 | --Query9
94 | --Find Customers payment ID,mode, vocher applied and their visist number
95 | SELECT anra.bill.Voucher_id, anra.payment.Payment_ID, anra.payment.Payment_Mode, anra.payment.Visit_Number
96 | FROM anra.bill,anra.payment
97 | WHERE anra.payment.Payment_ID=anra.bill.Payment_ID
98 | AND anra.bill.Amount_Paid> 1000;
99 |
100 | --Query10
101 | --Find product and their respective colour
102 | SELECT Product_Name, Colour
103 | FROM anra.`product details`
104 | INNER JOIN anra.product
105 | ON anra.`product details`.Product_ID=anra.product.Product_ID order by colour
106 |
107 | --Query11
108 | --Find the product Names their respective groups
109 | SELECT
110 | Group_Name, Product_Name
111 | FROM anra.`product group`
112 | INNER JOIN anra.product
113 | ON anra.`product group`.Group_ID=anra.product.Group_ID Order by Group_Name
114 |
115 |
116 |
117 |
118 | --TRIGGERS
119 | _________________________________________________________________________________________________________________________________________________
120 | --Trigger1
121 | --Find Customer name and updated time on customers table
122 | create table
123 | UpdateCustomerDetails
124 | (Customer_id int, First_Name varchar(20), update_time Datetime)
125 |
126 |
127 | delimiter \\
128 | create trigger UpdateCustomerDetails_trigger
129 | after update on customer
130 | for each row
131 | begin
132 | declare new_date datetime;
133 | set new_date=now();
134 |
135 | insert into UpdateCustomerDetails(Customer_id,First_Name,update_time)
136 | values(old.Customer_ID,old.First_Name, new_date);
137 |
138 | end \\
139 |
140 | --when customers details are updated the trigger is set
141 | update customer set Email_Address='naynaa@gmail.com'
142 | where Customer_ID=10000
143 |
144 | --updates can be seen in the newly created table
145 | select * from UpdateCustomerDetails
146 |
147 |
148 |
149 | --Trigger2
150 | --Trigger3
151 | --Trigger4
152 |
153 | --Stored_Procedure
154 | _______________________________________________________________________________________________________________________________________________
155 | --1
156 | --Stored procedure to find most deffective product from each product group
157 | call GetMostDeffective_Product()
158 |
159 | delimiter//
160 | Create Procedure GetMostDeffective_Product()
161 | Begin
162 | SELECT anra.reviews.Product_ID,anra.product.Product_Name,MAX(anra.reviews.`Defect%`) As `Defect%`, anra.`product group`.Group_Name
163 | from
164 | anra.reviews
165 | inner join
166 | anra.product
167 | on anra.reviews.Product_ID=anra.product.Product_ID
168 | inner join
169 | anra.`product group`
170 | on anra.product.Group_ID=anra.`product group`.Group_ID
171 | Group by `product group`.Group_Name
172 | end//
173 |
174 | --2
175 | --Stored procedure for employee assesment
176 | call GetEmployee_Assesment ()
177 |
178 | delimiter//
179 | Create Procedure GetEmployee_Assesment ()
180 | Begin
181 | Select count(anra.customer.Customer_ID) as Total_Cutomers ,anra.customer.Employee_ID,anra.employee.Designation,Salary
182 | from anra.customer
183 | Inner Join
184 | anra.employee
185 | on
186 | anra.employee.Employee_ID=anra.customer.Employee_ID
187 | group by Employee_ID
188 | order by count(anra.customer.Customer_ID) ;
189 | end//
190 |
191 | --3
192 | --Stored procedure to find customer details of highest Amount_Paid
193 | call findMaxBill()
194 |
195 | delimiter//
196 | Create Procedure findMaxBill()
197 | Begin
198 | select Max(anra.bill.Amount_Paid) As GreatestPurchase, anra.customer.Customer_ID,anra.customer.First_Name from anra.bill
199 | inner join
200 | anra.payment
201 | on anra.payment.Payment_ID=anra.bill.Payment_ID
202 | inner join
203 | anra.Customer
204 | on anra.payment.Customer_ID=anra.customer.Customer_ID;
205 | end//
206 |
207 | --Views
208 | ___________________________________________________________________________________________________________________________________________
209 | --1
210 | --Student as customer views
211 |
212 | create view StudentAsCustomer as ( select * from customer where Customer_Type = 'Student')
213 |
214 | --2
215 | --Product details with minimum defect% and high rating
216 | create view LeastDefectHighRating as
217 | (select product.Product_Name, min(reviews.`Defect%`), max(reviews.Quality_Rating)
218 | from anra.reviews
219 | inner join
220 | anra.product
221 | on anra.reviews.Product_ID=anra.product.Product_ID)
222 |
223 |
224 | --3
225 | --Products and the colours available
226 | create view ProductandAvailableColours as
227 | (SELECT Product_Name, Colour
228 | FROM anra.`product details`
229 | INNER JOIN anra.product
230 | ON anra.`product details`.Product_ID=anra.product.Product_ID order by colour)
231 |
232 |
233 | --4
234 | --Distinct employee departments whose salary is greater than 1200 limit to 4
235 | create view DistinctEmployeeDepartments as
236 | (Select DISTINCT anra.employee.Designation,anra.employee.Employee_Name,anra.employee.Department
237 | From anra.employee
238 | Where anra.employee.salary>1200 limit 4)
239 |
240 | --5
241 | --
242 | Create view TotalAmount as Total amount of revenue earned with respect to their purchasing modes
243 | (Select count(Payment_Mode) As Total_Cutomers, anra.payment.Payment_Mode,Sum(anra.bill.Amount_Paid)
244 | As Total_Amount
245 | from anra.payment
246 | inner join
247 | anra.bill
248 | on anra.payment.Payment_ID=anra.bill.Payment_ID
249 | group by Payment_Mode)
250 |
251 |
252 | --6
253 | Select count(anra.customer.Customer_ID) as Total_Customers, anra.customer.Emploee_ID,anra.emploee.Designation
254 | From anra.customer
255 | Inner Join
256 | anra.employee
257 | on anra.employee.Employee_ID=anra.customer.Employee_ID
258 | group by Employee_ID
259 | order by count(anra.customers.Customer_ID) desc
260 |
261 | --7
262 | --View Salary of employee group by type and department
263 | create view SalaryGroupbyType as
264 | (Select Salary, Employee_Type,Department
265 | From anra.employee
266 | Group by Employee_Type,Department)
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
--------------------------------------------------------------------------------
/DBMS Retail Application/SQL/Generated.SQL:
--------------------------------------------------------------------------------
1 | /*
2 | Created: 12/1/2016
3 | Modified: 12/6/2016
4 | Model: MySQL 5.7
5 | Database: MySQL 5.7
6 | */
7 |
8 |
9 | -- Create tables section -------------------------------------------------
10 |
11 | -- Table Employee
12 |
13 | CREATE TABLE `Employee`
14 | (
15 | `Designation` Varchar(20),
16 | `Department` Varchar(20),
17 | `Join_Date` Date,
18 | `ssn` Int(9) NOT NULL
19 | )
20 | ;
21 |
22 | CREATE INDEX `IX_Relationship30` ON `Employee` (`ssn`)
23 | ;
24 |
25 | ALTER TABLE `Employee` ADD PRIMARY KEY (`ssn`)
26 | ;
27 |
28 | -- Table Person
29 |
30 | CREATE TABLE `Person`
31 | (
32 | `First_Name` Varchar(20),
33 | `Last_Name` Varchar(20),
34 | `Email_Address` Varchar(20),
35 | `Phone_Number` Int(10),
36 | `ssn` Int(9) NOT NULL,
37 | `Date_Of_Birth` Date
38 | )
39 | ;
40 |
41 | ALTER TABLE `Person` ADD PRIMARY KEY (`ssn`)
42 | ;
43 |
44 | -- Table Orders
45 |
46 | CREATE TABLE `Orders`
47 | (
48 | `Order_ID` Char(4) NOT NULL,
49 | `Order_Date` Date NOT NULL,
50 | `Status` Char(20),
51 | `Shippent_Duration` Varchar(20) NOT NULL,
52 | `Payment_ID` Char(3) NOT NULL
53 | )
54 | ;
55 |
56 | CREATE INDEX `IX_Relationship15` ON `Orders` (`Payment_ID`)
57 | ;
58 |
59 | ALTER TABLE `Orders` ADD PRIMARY KEY (`Order_ID`)
60 | ;
61 |
62 | -- Table Customer
63 |
64 | CREATE TABLE `Customer`
65 | (
66 | `Customer_ID` Char(5) NOT NULL,
67 | `First_Name` Varchar(20) NOT NULL,
68 | `Last_Name` Varchar(20) NOT NULL,
69 | `Phone_Number` Int(10) NOT NULL,
70 | `Email_Address` Varchar(20) NOT NULL,
71 | `Customer_Type` Varchar(20) NOT NULL
72 | )
73 | ;
74 |
75 | ALTER TABLE `Customer` ADD PRIMARY KEY (`Customer_ID`)
76 | ;
77 |
78 | -- Table Zip Code
79 |
80 | CREATE TABLE `Zip Code`
81 | (
82 | `State` Varchar(20) NOT NULL,
83 | `Zipcode_ID` Char(5) NOT NULL,
84 | `City` Varchar(20) NOT NULL,
85 | `Address_ID` Char(2) NOT NULL
86 | )
87 | ;
88 |
89 | CREATE INDEX `IX_Relationship6` ON `Zip Code` (`Address_ID`)
90 | ;
91 |
92 | ALTER TABLE `Zip Code` ADD PRIMARY KEY (`Zipcode_ID`)
93 | ;
94 |
95 | -- Table Reviews
96 |
97 | CREATE TABLE `Reviews`
98 | (
99 | `Quality_Rating` Int(1) NOT NULL,
100 | `Defect%` Int(2) NOT NULL,
101 | `Review_ID` Varchar(4) NOT NULL,
102 | `Review_Date` Date
103 | )
104 | ;
105 |
106 | ALTER TABLE `Reviews` ADD PRIMARY KEY (`Review_ID`)
107 | ;
108 |
109 | -- Table Product
110 |
111 | CREATE TABLE `Product`
112 | (
113 | `Product_ID` Char(5) NOT NULL,
114 | `Product_Name` Varchar(20) NOT NULL,
115 | `Available_Number` Int(200),
116 | `Group_ID` Int(3) NOT NULL,
117 | `Supplier_ID` Char(4) NOT NULL,
118 | `Review_ID` Varchar(4)
119 | )
120 | ;
121 |
122 | CREATE INDEX `IX_Relationship1` ON `Product` (`Group_ID`)
123 | ;
124 |
125 | CREATE INDEX `IX_Relationship2` ON `Product` (`Supplier_ID`)
126 | ;
127 |
128 | CREATE INDEX `IX_Relationship3` ON `Product` (`Review_ID`)
129 | ;
130 |
131 | ALTER TABLE `Product` ADD PRIMARY KEY (`Product_ID`)
132 | ;
133 |
134 | -- Table Supplier
135 |
136 | CREATE TABLE `Supplier`
137 | (
138 | `Supplier_ID` Char(4) NOT NULL,
139 | `Supplier_Name` Varchar(20) NOT NULL,
140 | `Supply_Quantity` Varchar(2000) NOT NULL
141 | )
142 | ;
143 |
144 | ALTER TABLE `Supplier` ADD PRIMARY KEY (`Supplier_ID`)
145 | ;
146 |
147 | -- Table Payment
148 |
149 | CREATE TABLE `Payment`
150 | (
151 | `Payment_ID` Char(3) NOT NULL,
152 | `Payment_Mode` Varchar(20) NOT NULL,
153 | `Card_Type` Varchar(20) NOT NULL,
154 | `Card_Number` Int(12) NOT NULL,
155 | `CVV` Int(11) NOT NULL,
156 | `Name_On_Card` Varchar(20) NOT NULL,
157 | `Customer_ID` Char(5) NOT NULL,
158 | `Visit_Number` Int NOT NULL
159 | )
160 | ;
161 |
162 | CREATE INDEX `IX_Relationship11` ON `Payment` (`Customer_ID`)
163 | ;
164 |
165 | ALTER TABLE `Payment` ADD PRIMARY KEY (`Payment_ID`)
166 | ;
167 |
168 | -- Table Employees
169 |
170 | CREATE TABLE `Employees`
171 | (
172 | `Employee_ID` Char(3) NOT NULL,
173 | `Employee_Name` Varchar(20) NOT NULL,
174 | `SSN` Int(9) NOT NULL,
175 | `Designation` Varchar(10) NOT NULL,
176 | `Employee_Type` Varchar(20) NOT NULL,
177 | `Salary` Varchar(20) NOT NULL,
178 | `Payment_ID` Char(3) NOT NULL
179 | )
180 | ;
181 |
182 | CREATE INDEX `IX_Relationship8` ON `Employees` (`Payment_ID`)
183 | ;
184 |
185 | ALTER TABLE `Employees` ADD PRIMARY KEY (`Employee_ID`)
186 | ;
187 |
188 | -- Table Bill
189 |
190 | CREATE TABLE `Bill`
191 | (
192 | `Billing_ID` Char(5) NOT NULL,
193 | `Billing_Date` Date NOT NULL,
194 | `Amount_Paid` Double NOT NULL,
195 | `Voucher_ID` Varchar(2),
196 | `Payment_ID` Char(3) NOT NULL,
197 | `Order_ID` Char(4) NOT NULL
198 | )
199 | ;
200 |
201 | CREATE INDEX `IX_Relationship4` ON `Bill` (`Voucher_ID`)
202 | ;
203 |
204 | CREATE INDEX `IX_Relationship9` ON `Bill` (`Payment_ID`)
205 | ;
206 |
207 | CREATE INDEX `IX_Relationship16` ON `Bill` (`Order_ID`)
208 | ;
209 |
210 | ALTER TABLE `Bill` ADD PRIMARY KEY (`Billing_ID`)
211 | ;
212 |
213 | -- Table Voucher
214 |
215 | CREATE TABLE `Voucher`
216 | (
217 | `Voucher_ID` Varchar(2) NOT NULL,
218 | `Discount%` Int(2) NOT NULL
219 | )
220 | ;
221 |
222 | ALTER TABLE `Voucher` ADD PRIMARY KEY (`Voucher_ID`)
223 | ;
224 |
225 | -- Table Address
226 |
227 | CREATE TABLE `Address`
228 | (
229 | `Address_ID` Char(2) NOT NULL,
230 | `Apartment_Number` Int NOT NULL,
231 | `Street` Varchar(20) NOT NULL,
232 | `Apartment_Name` Varchar(20) NOT NULL,
233 | `Customer_ID` Char(5) NOT NULL
234 | )
235 | ;
236 |
237 | CREATE INDEX `IX_Relationship5` ON `Address` (`Customer_ID`)
238 | ;
239 |
240 | ALTER TABLE `Address` ADD PRIMARY KEY (`Address_ID`)
241 | ;
242 |
243 | -- Table Product Group
244 |
245 | CREATE TABLE `Product Group`
246 | (
247 | `Group_ID` Int(3) NOT NULL,
248 | `Group_Name` Varchar(20) NOT NULL
249 | )
250 | ;
251 |
252 | ALTER TABLE `Product Group` ADD PRIMARY KEY (`Group_ID`)
253 | ;
254 |
255 | -- Table Order Product
256 |
257 | CREATE TABLE `Order Product`
258 | (
259 | `Quantity` Int(200),
260 | `Product_ID` Char(5) NOT NULL,
261 | `Order_ID` Char(4) NOT NULL
262 | )
263 | ;
264 |
265 | CREATE INDEX `IX_Relationship12` ON `Order Product` (`Product_ID`)
266 | ;
267 |
268 | CREATE INDEX `IX_Relationship13` ON `Order Product` (`Order_ID`)
269 | ;
270 |
271 | ALTER TABLE `Order Product` ADD PRIMARY KEY (`Product_ID`,`Order_ID`)
272 | ;
273 |
274 | -- Table Product Details
275 |
276 | CREATE TABLE `Product Details`
277 | (
278 | `Product_ID` Char(5) NOT NULL,
279 | `Weight` Varchar(20),
280 | `Width` Double(2,2),
281 | `Height` Double(2,2),
282 | `Colour` Varchar(20)
283 | )
284 | ;
285 |
286 | ALTER TABLE `Product Details` ADD PRIMARY KEY (`Product_ID`)
287 | ;
288 |
289 | -- Table Customer Category
290 |
291 | CREATE TABLE `Customer Category`
292 | (
293 | `Customer_Category` Varchar(20) NOT NULL,
294 | `Customer_ID` Char(5) NOT NULL
295 | )
296 | ;
297 |
298 | ALTER TABLE `Customer Category` ADD PRIMARY KEY (`Customer_ID`)
299 | ;
300 |
301 | -- Create relationships section -------------------------------------------------
302 |
303 | ALTER TABLE `Product` ADD CONSTRAINT `belongs to` FOREIGN KEY (`Group_ID`) REFERENCES `Product Group` (`Group_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
304 | ;
305 |
306 | ALTER TABLE `Product` ADD CONSTRAINT `supplies` FOREIGN KEY (`Supplier_ID`) REFERENCES `Supplier` (`Supplier_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
307 | ;
308 |
309 | ALTER TABLE `Product` ADD CONSTRAINT `are given` FOREIGN KEY (`Review_ID`) REFERENCES `Reviews` (`Review_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
310 | ;
311 |
312 | ALTER TABLE `Bill` ADD CONSTRAINT `is included` FOREIGN KEY (`Voucher_ID`) REFERENCES `Voucher` (`Voucher_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
313 | ;
314 |
315 | ALTER TABLE `Address` ADD CONSTRAINT `will have` FOREIGN KEY (`Customer_ID`) REFERENCES `Customer` (`Customer_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
316 | ;
317 |
318 | ALTER TABLE `Zip Code` ADD CONSTRAINT `will zip` FOREIGN KEY (`Address_ID`) REFERENCES `Address` (`Address_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
319 | ;
320 |
321 | ALTER TABLE `Employees` ADD CONSTRAINT `monitors` FOREIGN KEY (`Payment_ID`) REFERENCES `Payment` (`Payment_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
322 | ;
323 |
324 | ALTER TABLE `Bill` ADD CONSTRAINT `Generates` FOREIGN KEY (`Payment_ID`) REFERENCES `Payment` (`Payment_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
325 | ;
326 |
327 | ALTER TABLE `Payment` ADD CONSTRAINT `makes` FOREIGN KEY (`Customer_ID`) REFERENCES `Customer` (`Customer_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
328 | ;
329 |
330 | ALTER TABLE `Order Product` ADD CONSTRAINT `product order relation` FOREIGN KEY (`Product_ID`) REFERENCES `Product` (`Product_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
331 | ;
332 |
333 | ALTER TABLE `Order Product` ADD CONSTRAINT `contains` FOREIGN KEY (`Order_ID`) REFERENCES `Orders` (`Order_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
334 | ;
335 |
336 | ALTER TABLE `Orders` ADD CONSTRAINT `Orders` FOREIGN KEY (`Payment_ID`) REFERENCES `Payment` (`Payment_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
337 | ;
338 |
339 | ALTER TABLE `Bill` ADD CONSTRAINT `is billed` FOREIGN KEY (`Order_ID`) REFERENCES `Orders` (`Order_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
340 | ;
341 |
342 | ALTER TABLE `Product Details` ADD CONSTRAINT `has details` FOREIGN KEY (`Product_ID`) REFERENCES `Product` (`Product_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
343 | ;
344 |
345 | ALTER TABLE `Customer Category` ADD CONSTRAINT `belong` FOREIGN KEY (`Customer_ID`) REFERENCES `Customer` (`Customer_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
346 | ;
347 |
348 |
--------------------------------------------------------------------------------