Files
base-sql/works/lab-01/lesson1_result_07.09_2nd_class.md
T
2026-09-07 13:54:38 +03:00

2.0 KiB

Table card {
  card_id integer [primary key, not null, unique]
  card_name text [not null]
  card_stage text [not null]
  card_hp integer [not null, check: `card_hp > 0`]
  card_num_in_pokedex integer [not null]
  card_type text [not null]
  card_height integer [not null, check: `card_height > 0`]
  card_weight integer [not null, check: `card_weight > 0`]
  card_retreat_cost integer [not null, check: `card_retreat_cost >= 0`]
  card_release_date date [not null]
  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, not null, unique]
  card_set_name text [not null]
  card_set_total_quantity integer [not null, check: `card_set_total_quantity > 0`]
  card_set_release_date date [not null]
}

Table attack {
  attack_id integer [primary key, not null, unique]
  attack_name text [not null]
  attack_base_damage integer [not null, check: `attack_base_damage >= 0`]
  attack_damage_modifier text
  attack_effect text
}

Table element_type {
  element_type_id integer [primary key, not null, unique]
  element_type_name text [not null]
}

Table illustrator {
  illustrator_id integer [primary key, not null, unique]
  illustrator_name text [not null]
}

Table attack_card {
  attack_card_id int [pk, not null, unique]
  card_id int [not null]
  attack_id int [not null]
}

Table attack_card_pricing {
  attack_card_pricing_id int [pk, not null, unique]
  attack_card_pricing_cost int [not null, check: `attack_card_pricing_cost >= 0`]
  attack_card_id int [not null]
  element_type_id int [not null]
}


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
Ref: card.card_id > attack_card.card_id
Ref: attack.attack_id > attack_card.attack_id
Ref: attack_card_pricing.attack_card_id < attack_card.attack_card_id
Ref: element_type.element_type_id < attack_card_pricing.element_type_id