By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
-- создание таблиц
CREATE TABLE `product` (
`product_id` int(11) NOT NULL,
`model` varchar(64) NOT NULL,
`sku` varchar(64) NOT NULL,
`grup_id` varchar(128) NOT NULL,
`quantity` int(4) NOT NULL DEFAULT 0,
`stock_status_id` int(11) NOT NULL,
`image` varchar(255) DEFAULT NULL,
`manufacturer_id` int(11) NOT NULL,
`shipping` tinyint(1) NOT NULL DEFAULT 1,
`price` decimal(15,4) NOT NULL DEFAULT 0.0000,
`weight` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`weight_class_id` int(11) NOT NULL DEFAULT 0,
`length` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`width` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`height` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`length_class_id` int(11) NOT NULL DEFAULT 0,
`subtract` tinyint(1) NOT NULL DEFAULT 1,
`minimum` int(11) NOT NULL DEFAULT 1,
`sort_order` int(11) NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 0,
`viewed` int(5) NOT NULL DEFAULT 0,
`date_added` datetime NOT NULL
);
CREATE TABLE `product_attribute` (
`product_id` int(11) NOT NULL,
`attribute_id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
`text` text NOT NULL
);
CREATE TABLE `attribute` (
`attribute_id` int(11) NOT NULL,
`attribute_group_id` int(11) NOT NULL,
Records: 3 Duplicates: 0 Warnings: 0
attribute_id | attribute_group_id | sort_order |
---|---|---|
1 | 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
Records: 2 Duplicates: 0 Warnings: 0
attribute_id | language_id | name |
---|---|---|
1 | 2 | Имя 1 |
4 | 2 | Имя 2 |
-- пример запроса
SELECT *
FROM attribute
LEFT JOIN attribute_description USING (attribute_id);
attribute_id | attribute_group_id | sort_order | language_id | name |
---|---|---|---|---|
1 | 2 | 3 | 2 | Имя 1 |
4 | 5 | 6 | 2 | Имя 2 |
7 | 8 | 9 | null | null |