Skip to content

Commit 4b104fd

Browse files
committed
Add examples tables
1 parent 74f56e0 commit 4b104fd

File tree

1 file changed

+40
-75
lines changed

1 file changed

+40
-75
lines changed

sql/mrp.sql

Lines changed: 40 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
-- SQL Dump
1+
-- phpMyAdmin SQL Dump
2+
-- version 5.2.1
3+
-- https://www.phpmyadmin.net/
4+
--
5+
-- Host: localhost
6+
-- Creato il: Ott 08, 2025 alle 13:22
7+
-- Versione del server: 5.6.21-log
8+
-- Versione PHP: 8.2.3
29

310
SET FOREIGN_KEY_CHECKS = 0;
411
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@@ -11,11 +18,16 @@ SET time_zone = "+00:00";
1118
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
1219
/*!40101 SET NAMES utf8mb4 */;
1320

21+
--
22+
-- Database: `mrp`
23+
--
24+
25+
-- --------------------------------------------------------
26+
1427
--
1528
-- Struttura della tabella `access_level`
1629
--
1730

18-
DROP TABLE IF EXISTS `access_level`;
1931
CREATE TABLE `access_level`
2032
(
2133
`id_access_level` int(11) NOT NULL,
@@ -37,7 +49,6 @@ INSERT INTO `access_level` (`id_access_level`, `name`) VALUES
3749
-- Struttura della tabella `bom`
3850
--
3951

40-
DROP TABLE IF EXISTS `bom`;
4152
CREATE TABLE `bom`
4253
(
4354
`parent_part_code` varchar(40) NOT NULL,
@@ -51,7 +62,6 @@ CREATE TABLE `bom`
5162
-- Struttura della tabella `category`
5263
--
5364

54-
DROP TABLE IF EXISTS `category`;
5565
CREATE TABLE `category`
5666
(
5767
`category_id` int(11) NOT NULL,
@@ -73,10 +83,9 @@ VALUES (1, 'Computer', 1),
7383
-- --------------------------------------------------------
7484

7585
--
76-
-- Struttura della tabella customer
86+
-- Struttura della tabella `customer`
7787
--
7888

79-
DROP TABLE IF EXISTS `customer`;
8089
CREATE TABLE `customer` (
8190
`customer_id` int(11) NOT NULL,
8291
`name` varchar(45) DEFAULT NULL,
@@ -89,17 +98,19 @@ CREATE TABLE `customer` (
8998
-- Dump dei dati per la tabella `customer`
9099
--
91100

92-
INSERT INTO `customer` (`customer_id`, `name`, `email`, `nationality`, `assurance`) VALUES
93-
(11, 'Mario Rossi', 'm.rossi@email.com', 'it', 1),
94-
(12, 'Elena Verdi', 'elena.verdi@email.com', 'it', 1);
101+
INSERT INTO `customer` (`customer_id`, `name`, `email`, `nationality`, `assurance`) VALUES (11, 'Mario Rossi',
102+
'mario.rossi@email.it',
103+
'it', 3),
104+
(12, 'Elen Green',
105+
'elen.green@email.com',
106+
'out', 1);
95107

96108
-- --------------------------------------------------------
97109

98110
--
99111
-- Struttura della tabella `customer_order`
100112
--
101113

102-
DROP TABLE IF EXISTS `customer_order`;
103114
CREATE TABLE `customer_order` (
104115
`order_id` int(11) NOT NULL,
105116
`order_date` date DEFAULT NULL,
@@ -113,7 +124,6 @@ CREATE TABLE `customer_order` (
113124
-- Struttura della tabella `file_type`
114125
--
115126

116-
DROP TABLE IF EXISTS `file_type`;
117127
CREATE TABLE `file_type` (
118128
`file_type_id` int(11) NOT NULL,
119129
`name` varchar(45) DEFAULT NULL
@@ -125,7 +135,6 @@ CREATE TABLE `file_type` (
125135
-- Struttura della tabella `good_movement`
126136
--
127137

128-
DROP TABLE IF EXISTS `good_movement`;
129138
CREATE TABLE `good_movement` (
130139
`good_movement_id` int(11) NOT NULL,
131140
`movement_date` varchar(45) DEFAULT NULL,
@@ -140,7 +149,6 @@ CREATE TABLE `good_movement` (
140149
-- Struttura della tabella `measurement_unit`
141150
--
142151

143-
DROP TABLE IF EXISTS `measurement_unit`;
144152
CREATE TABLE `measurement_unit` (
145153
`measurement_unit_code` varchar(10) NOT NULL,
146154
`name` varchar(45) DEFAULT NULL
@@ -160,7 +168,6 @@ INSERT INTO `measurement_unit` (`measurement_unit_code`, `name`) VALUES
160168
-- Struttura della tabella `order_file`
161169
--
162170

163-
DROP TABLE IF EXISTS `order_file`;
164171
CREATE TABLE `order_file` (
165172
`order_file_id` int(11) NOT NULL,
166173
`name` varchar(45) DEFAULT NULL,
@@ -177,7 +184,6 @@ CREATE TABLE `order_file` (
177184
-- Struttura della tabella `order_macro_activity`
178185
--
179186

180-
DROP TABLE IF EXISTS `order_macro_activity`;
181187
CREATE TABLE `order_macro_activity` (
182188
`activity_id` int(11) NOT NULL,
183189
`order_id` int(11) NOT NULL,
@@ -193,7 +199,6 @@ CREATE TABLE `order_macro_activity` (
193199
-- Struttura della tabella `order_status`
194200
--
195201

196-
DROP TABLE IF EXISTS `order_status`;
197202
CREATE TABLE `order_status` (
198203
`order_status_id` int(11) NOT NULL,
199204
`name` varchar(45) DEFAULT NULL
@@ -205,7 +210,6 @@ CREATE TABLE `order_status` (
205210
-- Struttura della tabella `part`
206211
--
207212

208-
DROP TABLE IF EXISTS `part`;
209213
CREATE TABLE `part` (
210214
`part_code` varchar(40) NOT NULL,
211215
`description` varchar(45) DEFAULT NULL,
@@ -222,46 +226,16 @@ CREATE TABLE `part` (
222226
-- Dump dei dati per la tabella `part`
223227
--
224228

225-
INSERT INTO `part` (`part_code`, `description`, `source`, `source_lead_time`, `measurement_unit_code`, `part_type_code`, `part_category_code`, `wastage`, `bom_levels`) VALUES ('01',
226-
'Descrizione',
227-
'BUY',
228-
10000,
229-
'kg',
230-
'PRODUCT',
231-
'01',
232-
1,
233-
10),
234-
('02', 'Demodulator', 'MAKE', 4, 'pz', 'RAW', '01', 1, 1),
229+
INSERT INTO `part` (`part_code`, `description`, `source`, `source_lead_time`, `measurement_unit_code`, `part_type_code`,
230+
`part_category_code`, `wastage`, `bom_levels`)
231+
VALUES ('01', 'Simple product', 'BUY', 10000, 'kg', 'PRODUCT', '01', 1, 10),
232+
('02', 'Demodulator', 'MAKE', 4, 'pz', 'SUB-ASSEMBLY', '01', 1, 1),
235233
('03', 'Converter', 'BUY', 5, 'pz', 'PRODUCT', '01', 10, 1),
236234
('04', 'Jack', 'BUY', 10, 'pz', 'PRODUCT', '02', 1, 2),
237-
('05',
238-
'Mouse Wheel2',
239-
'MAKE',
240-
5,
241-
'kg',
242-
'ASSEMBLY',
243-
'01',
244-
10,
245-
NULL),
246-
('06', 'Board rz-048', 'BUY', 10, 'pz', 'PRODUCT', '01', 1, NULL),
247-
('07',
248-
'Led mm 02 red',
249-
'MAKE',
250-
5,
251-
'pz',
252-
'RAW',
253-
'01',
254-
2,
255-
0),
256-
('08',
257-
'Led mm 02 green',
258-
'BUY',
259-
10,
260-
'kg',
261-
'SUB-ASSEMBLY',
262-
'02',
263-
1,
264-
NULL),
235+
('05', 'Mouse Wheel', 'MAKE', 5, 'kg', 'PRODUCT', '01', 10, 0),
236+
('06', 'Main Board Asus', 'BUY', 10, 'pz', 'ASSEMBLY', '01', 1, 0),
237+
('07', 'Red Led', 'MAKE', 5, 'pz', 'RAW', '01', 2, 0),
238+
('08', 'Green Led', 'BUY', 10, 'kg', 'RAW', '02', 1, 0),
265239
('09', 'RS232', 'BUY', 5, 'pz', 'PRODUCT', '01', 10, 0),
266240
('10', 'RJ45', 'BUY', 10, 'pz', 'PRODUCT', '01', 1, 0),
267241
('11', 'Cable', 'BUY', 5, 'pz', 'PRODUCT', '02', 10, 0);
@@ -272,7 +246,6 @@ INSERT INTO `part` (`part_code`, `description`, `source`, `source_lead_time`, `m
272246
-- Struttura della tabella `part_category`
273247
--
274248

275-
DROP TABLE IF EXISTS `part_category`;
276249
CREATE TABLE `part_category` (
277250
`part_category_code` varchar(20) NOT NULL,
278251
`name` varchar(45) DEFAULT NULL
@@ -292,7 +265,6 @@ INSERT INTO `part_category` (`part_category_code`, `name`) VALUES
292265
-- Struttura della tabella `part_type`
293266
--
294267

295-
DROP TABLE IF EXISTS `part_type`;
296268
CREATE TABLE `part_type` (
297269
`part_type_code` varchar(20) NOT NULL,
298270
`name` varchar(45) DEFAULT NULL
@@ -314,7 +286,6 @@ INSERT INTO `part_type` (`part_type_code`, `name`) VALUES
314286
-- Struttura della tabella `product`
315287
--
316288

317-
DROP TABLE IF EXISTS `product`;
318289
CREATE TABLE `product` (
319290
`product_id` int(11) NOT NULL,
320291
`product_name` varchar(20) NOT NULL,
@@ -342,7 +313,6 @@ INSERT INTO `product` (`product_id`, `product_name`, `category_id`, `list_order`
342313
-- Struttura della tabella `product_option`
343314
--
344315

345-
DROP TABLE IF EXISTS `product_option`;
346316
CREATE TABLE `product_option` (
347317
`product_option_id` int(11) NOT NULL,
348318
`option_name` varchar(30) NOT NULL,
@@ -376,7 +346,6 @@ INSERT INTO `product_option` (`product_option_id`, `option_name`, `product_id`,
376346
-- Struttura della tabella `stock`
377347
--
378348

379-
DROP TABLE IF EXISTS `stock`;
380349
CREATE TABLE `stock` (
381350
`store_code` int(11) NOT NULL,
382351
`part_code` varchar(40) NOT NULL,
@@ -389,7 +358,6 @@ CREATE TABLE `stock` (
389358
-- Struttura stand-in per le viste `stock_store`
390359
-- (Vedi sotto per la vista effettiva)
391360
--
392-
DROP VIEW IF EXISTS `stock_store`;
393361
CREATE TABLE `stock_store` (
394362
`part_code` varchar(40)
395363
,`store_code` int(11)
@@ -403,7 +371,6 @@ CREATE TABLE `stock_store` (
403371
-- Struttura della tabella `store`
404372
--
405373

406-
DROP TABLE IF EXISTS `store`;
407374
CREATE TABLE `store` (
408375
`store_code` int(11) NOT NULL,
409376
`name` varchar(45) DEFAULT NULL
@@ -415,7 +382,6 @@ CREATE TABLE `store` (
415382
-- Struttura della tabella `user`
416383
--
417384

418-
DROP TABLE IF EXISTS `user`;
419385
CREATE TABLE `user` (
420386
`id_user` int(11) NOT NULL COMMENT 'User ID',
421387
`id_access_level` int(11) NOT NULL COMMENT 'User Ascce Level',
@@ -429,25 +395,29 @@ CREATE TABLE `user` (
429395
`last_login` datetime DEFAULT NULL COMMENT 'Use last login date'
430396
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Users credentials';
431397

432-
433398
--
434399
-- Dump dei dati per la tabella `user`
435-
-- ALL PASSWORDS ARE: password
436400
--
437401

438402
INSERT INTO `user` (`id_user`, `id_access_level`, `full_name`, `email`, `password`, `salt`, `token`, `token_timestamp`,
439403
`enabled`, `last_login`)
440-
VALUES
441-
(1, 100, 'Administrator', 'admin@email.com','163e821c6ece715c5053e40bfcc46b27f4751fe3e85a53c297ee2aa7df1f5252339d24b6f0849b1dcf914fb96d6cad2220609d43e2b04c45ab3a1cb68d178b14','194744212166472874e64879.46699751', 1),
442-
(2, 60, 'Manager', 'manager@email.com','96887d1dd423fc6164cd51cf752bd363146b7fddfb0f0afb7f82f1c12c0d90943480ca599a2a05560c309884c925e06ad4d12fa1885c9ea50fd9bc368e62dc1d','205310676366472958b81a35.14153631', 1);
443-
--
404+
VALUES (1, 100, 'Administrators', 'admin@email.com',
405+
'f35d51264735fb85246c06120994aaa9c412bb8bf97dca68ba919296eb59ea3a80c5be96df92c539ceec0eaf9d7f13de88fbb97892e915ce4a5ba5676f9f89a1',
406+
'131150533065d5aee20ebf29.70637320', '0f3a8e1670a8ea050cf9d06335766254b368ad4ef739f62680d891b6589baed4',
407+
'2025-10-08 11:12:03', 1, '2025-10-08 13:12:03'),
408+
(2, 60, 'Manager', 'manager@email.com',
409+
'3df3965b3ad4816d1ae0b85d672ec8892b7f7be7887c06e9ea0cc6b3e1f7d3dc671ac51f9ee84e9aeef50aadb81cae4a4ce145cbed2ab0c022f7deba529a75ac',
410+
'88806375568e646421fa677.66983201', NULL, '2024-05-22 09:41:30', 1, NULL),
411+
(3, 50, 'User', 'user@email.com',
412+
'714201669d3ae4f70af67eb6648d0bd5bb501d5f8c5718a352bea32aab1234a58f63e942034f47ea0ee76bf181a21a55f63eb36785e2c0d08cd11f3e52bb05c7',
413+
'18381957068e6466552e2f6.84727060', NULL, '2024-05-22 09:41:30', 1, NULL);
414+
444415
-- --------------------------------------------------------
445416

446417
--
447418
-- Struttura stand-in per le viste `users_roles_names`
448419
-- (Vedi sotto per la vista effettiva)
449420
--
450-
DROP VIEW IF EXISTS `users_roles_names`;
451421
CREATE TABLE `users_roles_names` (
452422
`user_email` varchar(100)
453423
,`role_name` varchar(45)
@@ -459,7 +429,6 @@ CREATE TABLE `users_roles_names` (
459429
-- Struttura della tabella `wiki_application_role`
460430
--
461431

462-
DROP TABLE IF EXISTS `wiki_application_role`;
463432
CREATE TABLE `wiki_application_role` (
464433
`role_id` int(11) NOT NULL,
465434
`role_name` varchar(45) DEFAULT NULL
@@ -482,7 +451,6 @@ INSERT INTO `wiki_application_role` (`role_id`, `role_name`) VALUES
482451
-- Struttura della tabella `wiki_user`
483452
--
484453

485-
DROP TABLE IF EXISTS `wiki_user`;
486454
CREATE TABLE `wiki_user` (
487455
`user_id` int(11) NOT NULL,
488456
`user_name` varchar(45) DEFAULT NULL,
@@ -504,7 +472,6 @@ INSERT INTO `wiki_user` (`user_id`, `user_name`, `user_email`) VALUES
504472
-- Struttura della tabella `wiki_users_roles`
505473
--
506474

507-
DROP TABLE IF EXISTS `wiki_users_roles`;
508475
CREATE TABLE `wiki_users_roles` (
509476
`user_id` int(11) NOT NULL,
510477
`role_id` int(11) NOT NULL
@@ -531,7 +498,6 @@ INSERT INTO `wiki_users_roles` (`user_id`, `role_id`) VALUES
531498
--
532499
DROP TABLE IF EXISTS `stock_store`;
533500

534-
DROP VIEW IF EXISTS `stock_store`;
535501
CREATE OR REPLACE VIEW `stock_store` AS SELECT `stock`.`part_code` AS `part_code`, `stock`.`store_code` AS `store_code`, `stock`.`quantity` AS `quantity`, `store`.`name` AS `name` FROM (`stock` join `store`) WHERE (`store`.`store_code` = `stock`.`store_code`) ;
536502

537503
-- --------------------------------------------------------
@@ -541,7 +507,6 @@ CREATE OR REPLACE VIEW `stock_store` AS SELECT `stock`.`part_code` AS `part_cod
541507
--
542508
DROP TABLE IF EXISTS `users_roles_names`;
543509

544-
DROP VIEW IF EXISTS `users_roles_names`;
545510
CREATE OR REPLACE VIEW `users_roles_names` AS SELECT `wiki_user`.`user_email` AS `user_email`, `wiki_application_role`.`role_name` AS `role_name` FROM ((`wiki_user` join `wiki_users_roles` on((`wiki_user`.`user_id` = `wiki_users_roles`.`user_id`))) join `wiki_application_role` on((`wiki_users_roles`.`role_id` = `wiki_application_role`.`role_id`))) ;
546511

547512
--

0 commit comments

Comments
 (0)