diff --git a/Readme.md b/Readme.md index 29f9a64..c561952 100644 --- a/Readme.md +++ b/Readme.md @@ -3,5 +3,6 @@ * **Курс:** base-sql ## Список работ +* [Лабораторная работа №0](./works/lab-00) * [Лабораторная работа №1](./works/lab-01) * [Лабораторная работа №2](./works/lab-02) \ No newline at end of file diff --git a/works/lab-00/Readme.md b/works/lab-00/Readme.md new file mode 100644 index 0000000..acf80d6 --- /dev/null +++ b/works/lab-00/Readme.md @@ -0,0 +1,4 @@ +# Лабораторная работа №0 + +* **Студент:** Закиров Алим Альбертович +* **Вариант / Карточка:** Первичные и внешние ключи, ограничения целостности базы данных «Pokémon TCG» \ No newline at end of file diff --git a/works/lab-00/lesson0.md b/works/lab-00/lesson0.md new file mode 100644 index 0000000..dd8cacb --- /dev/null +++ b/works/lab-00/lesson0.md @@ -0,0 +1,78 @@ +```csharp +Table card { + card_id integer [primary key] + card_name text + card_stage text + card_hp integer + card_num_in_pokedex integer + card_type text + card_height integer + card_weight integer + card_retreat_cost integer + card_release_year date + card_set_id integer [not null] + attack_id integer [not null] + element_type_id integer [not null] + illustrator_id integer [not null] +} + +Table card_set { + card_set_id integer [primary key] + card_set_name text + card_set_total_quantity integer + card_set_release_year date +} + +Table attack { + attack_id integer [primary key] + attack_name text + attack_base_damage integer + attack_effect text +} + +Table element_type { + element_type_id integer [primary key] + element_type_name text +} + +Table illustrator { + illustrator_id integer [primary key] + illustrator_name text +} + +Ref: card_set.card_set_id < card.card_set_id +Ref: attack.attack_id < card.attack_id +Ref: element_type.element_type_id < card.element_type_id +Ref: illustrator.illustrator_id < card.illustrator_id + +// Записи(значения сделаны с помощью ИИ): + +Records card_set(card_set_id, card_set_name, card_set_total_quantity, card_set_release_year) { + 0, 'Base Set', 102, '1999-01-09' + 1, 'Jungle', 64, '1999-06-16' + 2, 'Fossil', 62, '1999-10-10' +} + +Records attack(attack_id, attack_name, attack_base_damage, attack_effect) { + 0, 'Thunder Shock', 10, 'Flip a coin. If tails, this attack does nothing.' + 1, 'Vine Whip', 35, null + 2, 'Ember', 30, 'Discard 1 Energy card attached to this Pokemon.' +} + +Records element_type(element_type_id, element_type_name) { + 0, 'Lightning' + 1, 'Grass' + 2, 'Fire' +} + +Records illustrator(illustrator_id, illustrator_name) { + 0, 'Mitsuhiro Arita' + 1, 'Ken Sugimori' + 2, 'Keiji Kinebuchi' +} + +Records card(card_id, card_name, card_stage, card_hp, card_num_in_pokedex, card_type, card_height, card_weight, card_retreat_cost, card_release_year, card_set_id, attack_id, element_type_id, illustrator_id) { + 0, 'Pikachu', 'Basic', 40, 25, 'Lightning', 4, 60, 1, '1999-01-09', 0, 0, 0, 0 + 1, 'Bulbasaur', 'Basic', 40, 1, 'Grass', 7, 69, 1, '1999-06-16', 1, 1, 1, 1 + 2, 'Charmander', 'Basic', 50, 4, 'Fire', 6, 85, 1, '1999-10-10', 2, 2, 2, 2 +} diff --git a/works/lab-01/Readme.md b/works/lab-01/Readme.md index 3b81ce5..6a3c8e0 100644 --- a/works/lab-01/Readme.md +++ b/works/lab-01/Readme.md @@ -1,86 +1,4 @@ # Лабораторная работа №1 * **Студент:** Закиров Алим Альбертович -* **Вариант / Карточка:** Первичные и внешние ключи, ограничения целостности базы данных «Pokémon TCG» - ---- - -## Ключевой код -```csharp -Table card { - card_id integer [primary key] - card_name text - card_stage text - card_hp integer - card_num_in_pokedex integer - card_type text - card_height integer - card_weight integer - card_retreat_cost integer - card_release_year date - card_set_id integer [not null] - attack_id integer [not null] - element_type_id integer [not null] - illustrator_id integer [not null] -} - -Table card_set { - card_set_id integer [primary key] - card_set_name text - card_set_total_quantity integer - card_set_release_year date -} - -Table attack { - attack_id integer [primary key] - attack_name text - attack_base_damage integer - attack_effect text -} - -Table element_type { - element_type_id integer [primary key] - element_type_name text -} - -Table illustrator { - illustrator_id integer [primary key] - illustrator_name text -} - -Ref: card_set.card_set_id < card.card_set_id -Ref: attack.attack_id < card.attack_id -Ref: element_type.element_type_id < card.element_type_id -Ref: illustrator.illustrator_id < card.illustrator_id - -// Записи(значения сделаны с помощью ИИ): - -Records card_set(card_set_id, card_set_name, card_set_total_quantity, card_set_release_year) { - 0, 'Base Set', 102, '1999-01-09' - 1, 'Jungle', 64, '1999-06-16' - 2, 'Fossil', 62, '1999-10-10' -} - -Records attack(attack_id, attack_name, attack_base_damage, attack_effect) { - 0, 'Thunder Shock', 10, 'Flip a coin. If tails, this attack does nothing.' - 1, 'Vine Whip', 35, null - 2, 'Ember', 30, 'Discard 1 Energy card attached to this Pokemon.' -} - -Records element_type(element_type_id, element_type_name) { - 0, 'Lightning' - 1, 'Grass' - 2, 'Fire' -} - -Records illustrator(illustrator_id, illustrator_name) { - 0, 'Mitsuhiro Arita' - 1, 'Ken Sugimori' - 2, 'Keiji Kinebuchi' -} - -Records card(card_id, card_name, card_stage, card_hp, card_num_in_pokedex, card_type, card_height, card_weight, card_retreat_cost, card_release_year, card_set_id, attack_id, element_type_id, illustrator_id) { - 0, 'Pikachu', 'Basic', 40, 25, 'Lightning', 4, 60, 1, '1999-01-09', 0, 0, 0, 0 - 1, 'Bulbasaur', 'Basic', 40, 1, 'Grass', 7, 69, 1, '1999-06-16', 1, 1, 1, 1 - 2, 'Charmander', 'Basic', 50, 4, 'Fire', 6, 85, 1, '1999-10-10', 2, 2, 2, 2 -} +* **Вариант / Карточка:** Проектирование ER-диаграммы базы данных «Pokémon TCG» в dbdiagram.io \ No newline at end of file diff --git a/works/lab-02/Readme.md b/works/lab-02/Readme.md index e5dfe11..2d82916 100644 --- a/works/lab-02/Readme.md +++ b/works/lab-02/Readme.md @@ -1,9 +1,4 @@ # Лабораторная работа №2 * **Студент:** Закиров Алим Альбертович -* **Вариант / Карточка:** Проектирование связей "Многие-ко-Многим" - ---- - -## Ключевой код -```csharp +* **Вариант / Карточка:** Реализация базы данных «Pokémon TCG» в SQL DDL и рефакторинг под типы карт \ No newline at end of file diff --git a/works/lab-02/lesson2.md b/works/lab-02/lesson2.md new file mode 100644 index 0000000..2e1e562 --- /dev/null +++ b/works/lab-02/lesson2.md @@ -0,0 +1 @@ +```csharp \ No newline at end of file