【发布时间】:2022-01-10 18:31:56
【问题描述】:
我试图向表中插入一些数据,mysql 给出了语法错误,我找不到,请我帮忙
INSERT INTO museums(id,name,rate,phone,opening_hours,closing_hours,location,image)
VALUES(1,"The Royal Automobile Museum",4.7,065411392,10:00:00, 7:00:00,"At Tibbiyya, Amman",LOAD_FILE('C:\xampp\htdocs\wael\images\The Royal Automobile Museum.jpg'));
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':00:00, 7:00:00,"At Tibbiyya, Amman",LOAD_FILE('C:\xampp\htdocs\wael\images\T...' at line 2
【问题讨论】:
-
你能发布一个数据库方案吗?我怀疑你的
opening/closing hours是字符串?你有一个错误..也许把"10:00:00" -
数据类型或列的大小可能不适合样本数据。请查看博物馆表并与您要插入的数据进行比较
-
是的,时间需要在双引号内,但仍然不插入图像,它给我错误“图像不能为空”
-
@aasemshoshari 。对于“Column 'image' cannot be null”错误可能的解决方案...How to insert BLOB and CLOB files in MySQL?