-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateDataBase.sql
41 lines (38 loc) · 1.18 KB
/
CreateDataBase.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
DROP DATABASE IF EXISTS yellowstore;
CREATE DATABASE yellowstore;
USE yellowstore;
CREATE TABLE ships
(
id INT NOT NULL
AUTO_INCREMENT,
shipName CHAR
(100) NOT NULL,
shipOrigin VARCHAR
(100) NOT NULL,
shipClass VARCHAR
(256) NOT NULL,
shipPrice VARCHAR
(100) NOT NULL,
PRIMARY KEY
(id)
);
INSERT INTO ships
(shipName, shipOrigin, shipClass, shipPrice)
VALUES
('Enteprise-1', 'Startrek', 'Galaxy', '666'),
('Enterprise-2', 'Startrek', 'Sovreign', '666'),
('Star-Destroyer', 'Starwars', 'Battleship', '800'),
('Imperial-Landing-Craft', 'Starwars', 'Shuttle', '444'),
('U.S.S-Sulaco', 'Aliens', 'Light-Assault-Carrier', '600'),
('The-Nostromo', 'Aliens', 'Hauler', '500'),
('Rocinante', 'The-Expanse', 'Corvette', '800'),
('SSV-Normandy', 'MassEffect', 'Frigate', '200'),
('USCSS-Prometheus', 'Prometheus', 'Heliades', '1000'),
('Millennium-Falcon', 'Starwars', 'Battleship', '700'),
('X-wing', 'Starwars', 'Battleship', '700');
CREATE TABLE Buy
(
id INT,
shipAmmount CHAR(100),
FOREIGN KEY (id) REFERENCES ships(id)
);