Advertisement
constk

mindbox sql data

Aug 24th, 2023
1,175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Скрипт создания и заполнения к тестовому от mindbox
  2.  
  3. create table product
  4. (
  5.     product_id int primary key GENERATED BY DEFAULT AS IDENTITY,
  6.     name varchar(100)
  7. );
  8. create table category
  9. (
  10.     category_id int primary key GENERATED BY DEFAULT AS IDENTITY,
  11.     name varchar(100)
  12. );
  13. create table product_and_category
  14. (
  15.     product_id int,
  16.     category_id int,
  17.     foreign key (product_id) references product(product_id),
  18.     foreign key (category_id) references category(category_id)
  19. );
  20. insert into product (name) values
  21. ('сыр'), ('молока'), ('кефир'), ('йогурт'), ('говядина'), ('свинина'), ('хлеб'), ('пирожное-картошка'), ('конфеты'), ('сладкий рулет'), ('Нечто');
  22. insert into category (name) values
  23. ('молочка'), ('мясо'), ('сладости'), ('хлебобулочные изделия')
  24. insert into product_and_category (product_id, category_id) values
  25. (1, 1),
  26. (2, 1),
  27. (3, 1),
  28. (4, 1),
  29. (5, 2),
  30. (6, 2),
  31. (7, 4),
  32. (8, 3),
  33. (8, 4),
  34. (9, 3),
  35. (10, 3),
  36. (10, 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement