generated from admin/template
для быстрой проверки
This commit is contained in:
@@ -0,0 +1,209 @@
|
|||||||
|
-- !!!!!!!!!!!!!!!!! use postgresql-schema.sql first !!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
insert into card_set (set_name, set_code, set_series, set_total_cards, set_release_date) values
|
||||||
|
('XY Базовый набор', 'XY1', 'XY', 146, '2014-02-05'),
|
||||||
|
('XY Огненная вспышка', 'XY2', 'XY', 106, '2014-05-07'),
|
||||||
|
('XY Яростный кулак', 'XY3', 'XY', 111, '2014-08-13'),
|
||||||
|
('XY Призрачные силы', 'XY4', 'XY', 119, '2014-11-05'),
|
||||||
|
('XY Первобытная дуэль', 'XY5', 'XY', 160, '2015-02-04'),
|
||||||
|
('XY Грохочущие небеса', 'XY6', 'XY', 108, '2015-05-06'),
|
||||||
|
('XY Древние истоки', 'XY7', 'XY', 98, '2015-08-12'),
|
||||||
|
('XY Прорыв', 'XY8', 'XY', 162, '2015-11-04'),
|
||||||
|
('XY Тайное превосходство', 'XY9', 'XY', 122, '2016-02-03'),
|
||||||
|
('XY Столкновение судеб', 'XY10', 'XY', 124, '2016-05-02');
|
||||||
|
|
||||||
|
CREATE TABLE staging_furious_fists (
|
||||||
|
card_id INTEGER,
|
||||||
|
card_number TEXT,
|
||||||
|
card_name TEXT,
|
||||||
|
card_rarity TEXT,
|
||||||
|
card_type TEXT,
|
||||||
|
card_image_url TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- import data
|
||||||
|
|
||||||
|
INSERT INTO card (
|
||||||
|
card_number, card_set_id, card_name,
|
||||||
|
card_rarity, card_type, card_image_url)
|
||||||
|
SELECT
|
||||||
|
s.card_number,
|
||||||
|
(SELECT set_id FROM card_set WHERE set_code = 'XY3'),
|
||||||
|
s.card_name,
|
||||||
|
s.card_rarity,
|
||||||
|
s.card_type,
|
||||||
|
s.card_image_url
|
||||||
|
FROM staging_furious_fists s
|
||||||
|
WHERE s.card_type IN ('Pokemon', 'Trainer', 'Energy');
|
||||||
|
|
||||||
|
DROP TABLE staging_furious_fists;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT card_id, card_number, card_name, card_type
|
||||||
|
FROM card
|
||||||
|
ORDER BY card_id;
|
||||||
|
|
||||||
|
INSERT INTO energy_type (energy_type_name, energy_type_icon_url) VALUES
|
||||||
|
('Grass', NULL),
|
||||||
|
('Fire', NULL),
|
||||||
|
('Water', NULL),
|
||||||
|
('Lightning', NULL),
|
||||||
|
('Psychic', NULL),
|
||||||
|
('Fighting', NULL),
|
||||||
|
('Darkness', NULL),
|
||||||
|
('Metal', NULL),
|
||||||
|
('Fairy', NULL),
|
||||||
|
('Dragon', NULL),
|
||||||
|
('Colorless', NULL);
|
||||||
|
|
||||||
|
INSERT INTO pokemon_sub_type (
|
||||||
|
sub_type_name, sub_type_default_prize_count, sub_type_global_rule_text
|
||||||
|
) VALUES
|
||||||
|
('Normal', 1, NULL),
|
||||||
|
('EX', 2, 'When a Pokémon-EX is Knocked Out, your opponent takes 2 Prize cards.'),
|
||||||
|
('MEGA', 2, 'When a MEGA Evolution Pokémon is Knocked Out, your opponent takes 2 Prize cards.'),
|
||||||
|
('BREAK', 1, NULL);
|
||||||
|
|
||||||
|
INSERT INTO ability_type (ability_type_name) VALUES
|
||||||
|
('Ability'),
|
||||||
|
('Poké-Power'),
|
||||||
|
('Poké-Body');
|
||||||
|
|
||||||
|
INSERT INTO trainer_printed_type (printed_type_name) VALUES
|
||||||
|
('Item'),
|
||||||
|
('Supporter'),
|
||||||
|
('Stadium'),
|
||||||
|
('Pokémon Tool');
|
||||||
|
|
||||||
|
INSERT INTO attack_name (attack_name_title) VALUES
|
||||||
|
('Nuzzle'),
|
||||||
|
('Quick Attack'),
|
||||||
|
('Circle Circuit'),
|
||||||
|
('Thunder Shock');
|
||||||
|
|
||||||
|
INSERT INTO pokemon_species (
|
||||||
|
pokemon_pokedex_number, species_eng_name,
|
||||||
|
species_generation, species_height_m, species_weight_kg
|
||||||
|
) VALUES
|
||||||
|
(25, 'Pikachu', 1, 0.4, 6.0),
|
||||||
|
(26, 'Raichu', 1, 0.8, 30.0),
|
||||||
|
(448, 'Lucario', 4, 1.2, 54.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT card_id, card_number, card_name FROM card ORDER BY card_id;
|
||||||
|
SELECT energy_type_id, energy_type_name FROM energy_type;
|
||||||
|
SELECT sub_type_id, sub_type_name FROM pokemon_sub_type;
|
||||||
|
SELECT attack_name_id, attack_name_title FROM attack_name;
|
||||||
|
SELECT printed_type_id, printed_type_name FROM trainer_printed_type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Карта покемона
|
||||||
|
INSERT INTO pokemon_card (
|
||||||
|
pokemon_card_id,
|
||||||
|
pokemon_pokedex_number,
|
||||||
|
pokemon_pokedex_entry_id,
|
||||||
|
pokemon_hp,
|
||||||
|
pokemon_stage,
|
||||||
|
pokemon_evolves_from,
|
||||||
|
pokemon_retreat_cost,
|
||||||
|
pokemon_sub_type_id,
|
||||||
|
pokemon_category,
|
||||||
|
pokemon_printed_height,
|
||||||
|
pokemon_printed_weight
|
||||||
|
) VALUES
|
||||||
|
(28, 25, NULL, 60, 'Basic', NULL, 1, 1, 'Мышонок', '0.4 м', '6.0 кг');
|
||||||
|
|
||||||
|
-- Атака 1: Nuzzle
|
||||||
|
INSERT INTO pokemon_attack_link (
|
||||||
|
link_pokemon_card_id, link_attack_name_id,
|
||||||
|
link_damage_value, link_effect_text
|
||||||
|
) VALUES
|
||||||
|
(28, 1, '0', 'Your opponent''s Active Pokémon is now Paralyzed.');
|
||||||
|
|
||||||
|
-- Атака 2: Quick Attack
|
||||||
|
INSERT INTO pokemon_attack_link (
|
||||||
|
link_pokemon_card_id, link_attack_name_id,
|
||||||
|
link_damage_value, link_effect_text
|
||||||
|
) VALUES
|
||||||
|
(28, 2, '20', 'Flip a coin. If heads, this attack does 20 more damage.');
|
||||||
|
|
||||||
|
-- Стоимость атаки Nuzzle (link_id смотрим через SELECT)
|
||||||
|
INSERT INTO attack_energy_cost (cost_link_id, cost_energy_type_id, cost_quantity)
|
||||||
|
VALUES
|
||||||
|
(1, 4, 1); -- link_id=1, тип Lightning, 1 шт.
|
||||||
|
|
||||||
|
-- Стоимость Quick Attack
|
||||||
|
INSERT INTO attack_energy_cost (cost_link_id, cost_energy_type_id, cost_quantity)
|
||||||
|
VALUES
|
||||||
|
(2, 4, 1), -- Lightning
|
||||||
|
(2, 11, 1); -- Colorless
|
||||||
|
|
||||||
|
-- Слабость к Fighting
|
||||||
|
INSERT INTO pokemon_attribute (
|
||||||
|
attribute_pokemon_card_id, attribute_energy_type_id,
|
||||||
|
attribute_kind, attribute_modifier_value
|
||||||
|
) VALUES
|
||||||
|
(28, 6, 'Weakness', 'x2');
|
||||||
|
|
||||||
|
-- Сопротивление Metal
|
||||||
|
INSERT INTO pokemon_attribute (
|
||||||
|
attribute_pokemon_card_id, attribute_energy_type_id,
|
||||||
|
attribute_kind, attribute_modifier_value
|
||||||
|
) VALUES
|
||||||
|
(28, 8, 'Resistance', '-20');
|
||||||
|
|
||||||
|
|
||||||
|
SELECT link_id, link_pokemon_card_id, link_attack_name_id
|
||||||
|
FROM pokemon_attack_link
|
||||||
|
WHERE link_pokemon_card_id = 28;
|
||||||
|
|
||||||
|
-- Смотрим ID печатного типа
|
||||||
|
SELECT printed_type_id, printed_type_name FROM trainer_printed_type;
|
||||||
|
-- Например: Item = 1, Supporter = 2, Stadium = 3, Pokémon Tool = 4
|
||||||
|
|
||||||
|
INSERT INTO trainer_card (
|
||||||
|
trainer_card_id, trainer_printed_type_id,
|
||||||
|
trainer_effect_text, trainer_is_ace_spec
|
||||||
|
) VALUES
|
||||||
|
(88, 2, 'Switch your Active Pokémon with 1 of your Benched Pokémon.', FALSE);
|
||||||
|
|
||||||
|
-- Смотрим ID типа энергии
|
||||||
|
SELECT energy_type_id, energy_type_name FROM energy_type;
|
||||||
|
|
||||||
|
INSERT INTO energy_card (
|
||||||
|
energy_card_id, energy_is_special,
|
||||||
|
energy_main_type_id, energy_effect_text
|
||||||
|
) VALUES
|
||||||
|
(103, TRUE, NULL, 'This card provides 1 Fighting energy. When attached, ...');
|
||||||
|
|
||||||
|
-- Перечень запросов
|
||||||
|
|
||||||
|
select card_name, card_hp
|
||||||
|
from card
|
||||||
|
where card_hp > 60;
|
||||||
|
|
||||||
|
select attack_title, attack_damage
|
||||||
|
from attack
|
||||||
|
order by attack_damage desc;
|
||||||
|
|
||||||
|
select attack_title, attack_damage
|
||||||
|
from attack
|
||||||
|
order by attack_damage asc
|
||||||
|
limit 2;
|
||||||
|
|
||||||
|
select card_name
|
||||||
|
from card
|
||||||
|
where card_name ilike '%pi%'
|
||||||
|
|
||||||
|
select pokemon_hp, pokemon_stage
|
||||||
|
from pokemon_card
|
||||||
|
where pokemon_stage = 'Basic' or pokemon_hp > 100;
|
||||||
|
|
||||||
|
select energy_type_name
|
||||||
|
from energy_type
|
||||||
|
where energy_type_name in ('Fire', 'Water', 'Lightning');
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
select card_name, card_hp
|
|
||||||
from card
|
|
||||||
where card_hp > 60;
|
|
||||||
|
|
||||||
select attack_title, attack_damage
|
|
||||||
from attack
|
|
||||||
order by attack_damage desc;
|
|
||||||
|
|
||||||
select attack_title, attack_damage
|
|
||||||
from attack
|
|
||||||
order by attack_damage asc;
|
|
||||||
|
|
||||||
select card_name
|
|
||||||
from card
|
|
||||||
where card_name ilike '%pi%'
|
|
||||||
|
|
||||||
select pokemon_hp, pokemon_stage
|
|
||||||
from pokemon_card
|
|
||||||
where pokemon_stage = 'Basic' or pokemon_hp > 100;
|
|
||||||
|
|
||||||
select energy_type_name
|
|
||||||
from energy_type
|
|
||||||
where energy_type_name in ('Fire', 'Water', 'Lightning');
|
|
||||||
Reference in New Issue
Block a user