Задавайте вопросы, мы ответим
Вы не зашли.
set foreign_key_checks=0;
DROP TABLE IF EXISTS VR_Base_Brand;
DROP TABLE IF EXISTS VR_Base_Dimension;
DROP TABLE IF EXISTS VR_Base_Removablepanel;
DROP TABLE IF EXISTS VR_Base_Maximumpower;
DROP TABLE IF EXISTS VR_Base_Equalizer;
DROP TABLE IF EXISTS VR_Base_Сarreceiver;
CREATE TABLE VR_Base_Brand (
VR_Base_Brand_id INT(2),
VR_Base_Brand_name VARCHAR(20),
PRIMARY KEY (VR_Base_Brand_id)
);
CREATE TABLE VR_Base_Dimension (
VR_Base_Dimension_id INT(4),
VR_Base_Dimension_name VARCHAR(10),
PRIMARY KEY (VR_Base_Dimension_id)
);
CREATE TABLE VR_Base_Removablepanel (
VR_Base_Removablepanel_id INT(2),
VR_Base_Removablepanel_name VARCHAR(15),
PRIMARY KEY (VR_Base_Removablepanel_id)
);
CREATE TABLE VR_Base_Maximumpower (
VR_Base_Maximumpower_id INT(3),
VR_Base_Maximumpower_name VARCHAR(10),
PRIMARY KEY (VR_Base_Maximumpower_id)
);
CREATE TABLE VR_Base_Equalizer (
VR_Base_Equalizer_id INT(2),
VR_Base_Equalizer_name VARCHAR(15),
PRIMARY KEY (VR_Base_Equalizer_id)
);
CREATE TABLE VR_Base_Сarreceiver (
VR_Base_D_name VARCHAR(100),
VR_Base_D_brand INT(1),
VR_Base_D_Dimension INT(1),
VR_Base_D_Removablepanel INT(1),
VR_Base_D_Maximumpower INT(1),
VR_Base_D_Equalizer INT(1),
INDEX(VR_Base_D_name),
VR_Base_D_price DECIMAL(10,2),
PRIMARY KEY (VR_Base_D_name),
FOREIGN KEY (VR_Base_D_brand) REFERENCES VR_Base_Brand(VR_Base_Brand_id),
FOREIGN KEY (VR_Base_D_Dimension) REFERENCES VR_Base_Dimension(VR_Base_Dimension_id),
FOREIGN KEY (VR_Base_D_Removablepanel) REFERENCES VR_Base_Removablepanel(VR_Base_Removablepanel_id),
FOREIGN KEY (VR_Base_D_Maximumpower) REFERENCES VR_Base_Maximumpower(VR_Base_Maximumpower_id),
FOREIGN KEY (VR_Base_D_Equalizer) REFERENCES VR_Base_Equalizer(VR_Base_Equalizer_id)
);
set foreign_key_checks=1;
INSERT INTO VR_Base_Brand (VR_Base_Brand_id, VR_Base_Brand_name)
VALUES (0, 'Pioneer'),
(1, 'Digma'),
INSERT INTO VR_Base_Dimension (VR_Base_Dimension_id, VR_Base_Dimension_name)
VALUES (0, ' 1 din '),
(1, ' 2 din '),
(2, ' 3 din '),
(3, ' 4 din '),
INSERT INTO VR_Base_Removablepanel (VR_Base_Removablepanel_id, VR_Base_Removablepanel_name)
VALUES (0, 'нет' ),
(1, 'есть'),
INSERT INTO VR_Base_Maximumpower (VR_Base_Maximumpower_id, VR_Base_Maximumpower_name)
VALUES (0, '4 x 50 Вт'),
(1, '4 x 45 Вт'),
(2, '4 x 100 Вт'),
INSERT INTO VR_Base_Equalizer (VR_Base_Equalizer_id, VR_Base_Equalizer_name)
VALUES (0, 'Нет'),
(1, 'Есть'),
INSERT INTO VR_Base_Сarreceiver (VR_Base_D_name, VR_Base_D_brand, VR_Base_D_Dimension, VR_Base_D_Removablepanel, VR_Base_D_Maximumpower,
VR_Base_D_Equalizer, VR_Base_D_price)
VALUE ('Pioneer MVH-S120UB', 0, 0, 1, 0, 1, 3380),
('Digma DCR-330MC', 1, 0, 0, 1, 1, 1390),
('Pioneer SPH-10BT', 0, 0, 1, 0, 1, 8999),
('Pioneer MVH-X460UI', 0, 0, 1, 0, 1, 6690),
('Pioneer MVH-280FD', 0, 0, 1, 2, 1, 7690),
('Pioneer MVH-A210BT', 0, 1, 1, 0, 1, 16740),
('Pioneer DEH-4800FD', 0, 0, 1, 2, 1, 8510),
('Pioneer MVH-X460UI', 0, 1, 0, 0, 1, 10190),
('Pioneer FH-X380UB', 0, 1, 0, 0, 0, 7490),
('Pioneer MVH-29BT', 0, 0, 1, 0, 1, 5990),
('Pioneer MVH-S120UBW', 0, 0, 1, 0, 1, 3499),
('Pioneer AVH-G110DVD', 0, 1, 0, 0, 1, 8990),
('Pioneer MVH-A110V', 0, 1, 0, 0, 1, 9873),
('Pioneer DEH-S120UBB', 0, 0, 1, 0, 1, 5050),
('Pioneer DEH-S320BT', 0, 0, 1, 0, 1, 7300),
-- output
-- SELECT * FROM VR_Base_Dashcam;
SELECT * FROM VR_Base_Brand;
SELECT * FROM VR_Base_Dimension;
SELECT * FROM VR_Base_Removablepanel;
SELECT * FROM VR_Base_Maximumpower;
SELECT * FROM VR_Base_Equalizer;
SELECT VR_Base_D_name AS 'Наименование',
brand.VR_Base_Brand_name AS 'Бренд',
Dimension.VR_Base_Dimension_name AS 'Метод сварки',
Removablepanel.VR_Base_Removablepanel_name AS 'Сварочный ток',
Maximumpower.VR_Base_Maximumpower_name AS 'Напряжение',
Equalizer.VR_Base_Equalizer_name AS 'Диаметр электродов',
VR_Base_D_price AS 'Цена'
FROM VR_Base_Сarreceiver AS Сarreceiver
INNER JOIN VR_Base_Brand AS brand ON brand.VR_Base_Brand_id = Сarreceiver.VR_Base_D_brand
INNER JOIN VR_Base_Dimension AS Dimension ON Dimension.VR_Base_Dimension_id = Сarreceiver.VR_Base_D_Dimension
INNER JOIN VR_Base_Removablepanel AS Removablepanel ON Removablepanel.VR_Base_Removablepanel_id = Сarreceiver.VR_Base_D_Removablepanel
INNER JOIN VR_Base_Maximumpower AS Maximumpower ON Maximumpower.VR_Base_Maximumpower_id = Сarreceiver.VR_Base_D_Maximumpower
INNER JOIN VR_Base_Equalizer AS Equalizer ON Equalizer.VR_Base_Equalizer_id = Сarreceiver.VR_Base_D_Equalizer;
Выдаёт такую ошибку:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO VR_Base_Dimension (VR_Base_Dimension_id, VR_Base_Dimension_name)
' at line 7
Не могу понять, что надо сделать...
Неактивен
команды разделяются ;
а у вас инсерты заканчиваются ,
Неактивен
Исправил то что вы сказали, появилась эта
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ');
CREATE TABLE VR_Base_dimension (
VR_Base_dimension_id INT(4),
VR' at line 8
Неактивен
код показанный в первом посте в части создания таблиц выполняется корректно.
Неактивен