fork download
  1. Export SQL
  2. Sql CREATE TABLE `productsNestTree` (
  3. `id` bigint NOT NULL,
  4. `name` varchar(63) NOT NULL,
  5. `left` bigint NOT NULL,
  6. `right` bigint NOT NULL,
  7. `cat_level` int NOT NULL,
  8. PRIMARY KEY (`id`)
  9. );
  10.  
  11. CREATE TABLE `productsAttribute` (
  12. `attribute_id` bigint NOT NULL,
  13. `product_id` bigint NOT NULL AUTO_INCREMENT,
  14. `attribute_name` varchar(63) NOT NULL,
  15. PRIMARY KEY (`attribute_id`)
  16. );
  17.  
  18. CREATE TABLE `attributesValues` (
  19. `attribute_id` bigint NOT NULL,
  20. `productd_id` bigint NOT NULL,
  21. `attribute_value` varchar(63) NOT NULL
  22. );
  23.  
  24. CREATE TABLE `users` (
  25. `id` bigint NOT NULL,
  26. `email` varchar(63) NOT NULL UNIQUE,
  27. `name` varchar(63) NOT NULL,
  28. PRIMARY KEY (`id`)
  29. );
  30.  
  31. CREATE TABLE `orders` (
  32. `order_id` bigint NOT NULL,
  33. `user_id` bigint NOT NULL,
  34. `user_id` bigint NOT NULL,
  35. PRIMARY KEY (`order_id`)
  36. );
  37.  
  38. CREATE TABLE `ordersProducts` (
  39. `order_id` bigint NOT NULL,
  40. `product_id` bigint NOT NULL
  41. );
  42.  
  43. ALTER TABLE `productsNestTree` ADD CONSTRAINT `productsNestTree_fk0` FOREIGN KEY (`id`) REFERENCES `productsAttribute`(`product_id`);
  44.  
  45. ALTER TABLE `productsAttribute` ADD CONSTRAINT `productsAttribute_fk0` FOREIGN KEY (`attribute_id`) REFERENCES `attributesValues`(`attribute_id`);
  46.  
  47. ALTER TABLE `users` ADD CONSTRAINT `users_fk0` FOREIGN KEY (`id`) REFERENCES `orders`(`user_id`);
  48.  
  49. ALTER TABLE `orders` ADD CONSTRAINT `orders_fk0` FOREIGN KEY (`order_id`) REFERENCES `ordersProducts`(`order_id`);
  50.  
  51. ALTER TABLE `ordersProducts` ADD CONSTRAINT `ordersProducts_fk0` FOREIGN KEY (`product_id`) REFERENCES `productsNestTree`(`id`);
  52.  
Success #stdin #stdout #stderr 0s 4340KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 1: near "Export": syntax error
Error: near line 11: near "AUTO_INCREMENT": syntax error
Error: near line 31: duplicate column name: user_id
Error: near line 43: no such table: productsNestTree
Error: near line 45: no such table: productsAttribute
Error: near line 47: near "CONSTRAINT": syntax error
Error: near line 49: no such table: orders
Error: near line 51: near "CONSTRAINT": syntax error