· 7 years ago · Oct 20, 2018, 01:22 PM
1
2DROP DATABASE IF EXISTS `user_ws`;
3CREATE DATABASE IF NOT EXISTS `user_ws`
4 DEFAULT CHARACTER SET latin1
5 COLLATE latin1_swedish_ci;
6USE `user_ws`;
7
8DROP TABLE IF EXISTS `stats`;
9CREATE TABLE `stats` (
10 `id` int(11) NOT NULL,
11 `nom` text NOT NULL,
12 `type` int(11) NULL DEFAULT NULL,
13 `caracteristique` text NOT NULL
14)
15 ENGINE = InnoDB
16 DEFAULT CHARSET = latin1;
17
18
19INSERT INTO `stats` (`id`, `nom`, `type`, `caracteristique`)
20VALUES (1, 'Combat', 1, 'Vise l\'offensive physique.'),
21 (2, 'Plante', 3, 'Des pokemons 100% bio aux attaques de grande puissance'),
22 (3, 'Dragon', 2, 'Pokemons très rares et puissants avec des résistances à des types très courants'),
23 (4, 'Eau', 4, 'Tous les doubles types possibles avec le type Eau existent. C\'est le type le plus représenté'),
24 (5, 'Insecte', 5, 'Pour tous les fans d\'entomologie'),
25 (6, 'Psy', 6, 'C\'est surement un complexe en rapport à l\'enfance'),
26 (7, 'Fée', 7, 'Tous des amis de Peter Pan');
27
28
29
30ALTER TABLE `stats`
31 ADD PRIMARY KEY (`id`),
32 ADD KEY `type` (`type`);
33
34ALTER TABLE `stats`
35 MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,
36 AUTO_INCREMENT = 8;
37
38
39DROP TABLE IF EXISTS `pokemons`;
40CREATE TABLE `pokemons` (
41 `id` int(11) NOT NULL,
42 `nom` text NOT NULL,
43 `numero` int(11) NOT NULL,
44 `type_pokemon` int(11) NULL DEFAULT NULL,
45 `image` text NOT NULL
46)
47 ENGINE = InnoDB
48 DEFAULT CHARSET = latin1;
49ALTER TABLE `pokemons`
50 ADD PRIMARY KEY (`id`),
51 ADD KEY `type` (`type_pokemon`);
52
53
54ALTER TABLE `pokemons`
55 MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,
56 AUTO_INCREMENT = 16;
57
58
59INSERT INTO `pokemons` (`id`, `nom`, `numero`, `type_pokemon`, `image`)
60VALUES (1, 'Draieul', 780, 2, 'http://www.pokepedia.fr/images/c/c7/Draïeul-SL.png'),
61 (2, 'Minidraco', 147, 2, 'http://www.pokepedia.fr/images/1/11/Minidraco-RFVF.png'),
62 (3, 'Colimucus', 705, 2, 'http://www.pokepedia.fr/images/6/68/Colimucus-XY.png'),
63 (4, 'Hyporoi', 230, 2, 'http://www.pokepedia.fr/images/9/90/Hyporoi-HGSS.png'),
64 (5, 'Kicklee', 106, 1, 'http://www.pokepedia.fr/images/e/e7/Kicklee-RFVF.png'),
65 (6, 'Machoc', 66, 1, 'http://www.pokepedia.fr/images/7/75/Machoc-RFVF.png'),
66 (7, 'Debugant', 236, 1, 'http://www.pokepedia.fr/images/3/38/Debugant-HGSS.png'),
67 (8, 'Bulbizarre', 1, 3, 'http://www.pokepedia.fr/images/e/ef/Bulbizarre-RFVF.png'),
68 (9, 'Otaria', 86, 4, 'http://www.pokepedia.fr/images/3/31/Otaria-RFVF.png'),
69 (10, 'Leveinard', 113, 7, 'http://www.pokepedia.fr/images/9/96/Leveinard-RFVF.png'),
70 (11, 'Insécateur', 123, 5, 'http://www.pokepedia.fr/images/a/a4/Insécateur-RFVF.png'),
71 (12, 'Mystherbe', 43, 3, 'http://www.pokepedia.fr/images/3/39/Mystherbe-RFVF.png'),
72 (13, 'Boustiflor', 70, 3, 'http://www.pokepedia.fr/images/f/f5/Boustiflor-RFVF.png'),
73 (14, 'Kokiyas', 90, 4, 'http://www.pokepedia.fr/images/e/eb/Kokiyas-RFVF.png'),
74 (15, 'Aéromite', 49, 5, 'http://www.pokepedia.fr/images/0/0f/Aéromite-RFVF.png');
75
76
77ALTER TABLE `stats`
78 ADD CONSTRAINT `stats_ibfk_1` FOREIGN KEY (`type`) REFERENCES `pokemons` (`type_pokemon`)
79 ON DELETE SET NULL
80 ON UPDATE RESTRICT;