-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstantiate.sql
73 lines (73 loc) · 4.05 KB
/
Instantiate.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
CREATE DATABASE BOM1;
|
USE BOM1;
|
CREATE PROCEDURE instantiate_metal_blue()
BEGIN
CREATE TABLE metal_blue(
part_id int AUTO_INCREMENT,
part_name varchar(30),
parent varchar(30),
PRIMARY KEY(part_id)
);
INSERT INTO metal_blue(part_name,parent) VALUES('Top Barrel Assembled', NULL), ('Rest Of Pen Assembled', NULL), ('Blue Box Assembled',NULL),
('Metal Top Barrel', 'Top Barrel Assembled'), ('Metal Blue Clip', 'Top Barrel Assembled'), ('Bottom Barrel Assembled', 'Rest of Pen Assembled'), ('Cartridge Assembled', 'Rest of Pen Assembled'),
('Metal Bottom Barrel', 'Bottom Barrel Assembled'), ('Blue Grip', 'Bottom Barrel Assembled'), ('Metal Thruster','Rest of Pen Assembled'),
('Cam','Rest of Pen Assembled'),('Spring','Rest of Pen Assembled'), ('Cartridge Body','Cartridge Assembled'),('Cartridge Cap','Cartridge Assembled'),
('Cartridge Tip','Cartridge Assembled'),('Blue Ink','Cartridge Assembled'), ('Blue Box Top','Blue Box Assembled'),('Blue Box Bottom','Blue Box Assembled'),('Box Insert','Blue Box Assembled');
END;
|
CREATE PROCEDURE instantiate_metal_red()
BEGIN
CREATE TABLE metal_red(
part_id int AUTO_INCREMENT,
part_name varchar(30),
parent varchar(30),
PRIMARY KEY(part_id)
);
INSERT INTO metal_red(part_name,parent) VALUES('Top Barrel Assembled', NULL), ('Rest Of Pen Assembled', NULL), ('Red Box Assembled',NULL),
('Metal Top Barrel', 'Top Barrel Assembled'), ('Metal Red Clip', 'Top Barrel Assembled'), ('Bottom Barrel Assembled', 'Rest of Pen Assembled'), ('Cartridge Assembled', 'Rest of Pen Assembled'),
('Metal Bottom Barrel', 'Bottom Barrel Assembled'), ('Red Grip', 'Bottom Barrel Assembled'), ('Metal Thruster','Rest of Pen Assembled'),
('Cam','Rest of Pen Assembled'),('Spring','Rest of Pen Assembled'), ('Cartridge Body','Cartridge Assembled'),('Cartridge Cap','Cartridge Assembled'),
('Cartridge Tip','Cartridge Assembled'),('Red Ink','Cartridge Assembled'), ('Red Box Top','Red Box Assembled'),('Red Box Bottom','Red Box Assembled'),('Box Insert','Red Box Assembled');
END;
|
CREATE PROCEDURE instantiate_plastic_red()
BEGIN
CREATE TABLE plastic_red(
part_id int AUTO_INCREMENT,
part_name varchar(30),
parent varchar(30),
PRIMARY KEY(part_id)
);
INSERT INTO plastic_red(part_name,parent) VALUES('Top Barrel Assembled', NULL), ('Rest Of Pen Assembled', NULL), ('Red Box Assembled',NULL),
('Plastic Top Barrel', 'Top Barrel Assembled'), ('Plastic Red Clip', 'Top Barrel Assembled'), ('Bottom Barrel Assembled', 'Rest of Pen Assembled'), ('Cartridge Assembled', 'Rest of Pen Assembled'),
('Plastic Bottom Barrel', 'Bottom Barrel Assembled'), ('Red Grip', 'Bottom Barrel Assembled'), ('Plastic Thruster','Rest of Pen Assembled'),
('Cam','Rest of Pen Assembled'),('Spring','Rest of Pen Assembled'), ('Cartridge Body','Cartridge Assembled'),('Cartridge Cap','Cartridge Assembled'),
('Cartridge Tip','Cartridge Assembled'),('Red Ink','Cartridge Assembled'), ('Red Box Top','Red Box Assembled'),('Red Box Bottom','Red Box Assembled'),('Box Insert','Red Box Assembled');
END;
|
CREATE PROCEDURE instantiate_plastic_blue()
BEGIN
CREATE TABLE plastic_blue(
part_id int AUTO_INCREMENT,
part_name varchar(30),
parent varchar(30),
PRIMARY KEY(part_id)
);
INSERT INTO plastic_blue(part_name,parent) VALUES('Top Barrel Assembled', NULL), ('Rest Of Pen Assembled', NULL), ('Blue Box Assembled',NULL),
('Plastic Top Barrel', 'Top Barrel Assembled'), ('Plastic Blue Clip', 'Top Barrel Assembled'), ('Bottom Barrel Assembled', 'Rest of Pen Assembled'), ('Cartridge Assembled', 'Rest of Pen Assembled'),
('Plastic Bottom Barrel', 'Bottom Barrel Assembled'), ('Blue Grip', 'Bottom Barrel Assembled'), ('Plastic Thruster','Rest of Pen Assembled'),
('Cam','Rest of Pen Assembled'),('Spring','Rest of Pen Assembled'), ('Cartridge Body','Cartridge Assembled'),('Cartridge Cap','Cartridge Assembled'),
('Cartridge Tip','Cartridge Assembled'),('Blue Ink','Cartridge Assembled'), ('Blue Box Top','Blue Box Assembled'),('Blue Box Bottom','Blue Box Assembled'),('Box Insert','Blue Box Assembled');
END;
|
call instantiate_plastic_blue();
|
call instantiate_metal_blue();
|
call instantiate_plastic_red();
|
call instantiate_metal_red();
|