在我放入我的值的行上不斷出現錯誤,它專門顯示在「15 Water Road」的「15」中,與VALUES相同。錯誤狀態:「缺少右括號」SQL
「語法錯誤:缺少右括號」。
此外,當我嘗試XAMPP運行它,我得到:
「你在你的SQL語法錯誤;檢查對應於您的MariaDB的服務器版本使用附近的「水路正確的語法手冊, 0412345678,750,3),(2,Smith,2,14 Water Rd,0412345679,400,4),「
DB和SQL非常新,任何幫助將不勝感激。
CREATE TABLE Customer_info (
CustomerID int,
LastName varchar(50),
Username int,
Address varchar(777),
PhoneNumber int,
TotalSpent int,
OrdersCompleted int
);
INSERT INTO Customer_info (CustomerID, LastName, Username, Address, PhoneNumber, TotalSpent, OrdersCompleted)
VALUES (1, Mason, 1, 15 Water Rd, 0412345678, 750, 3), (2, Smith, 2, 14 Water Rd, 0412345679, 400, 4),
(3, Lens, 3, 1 Water rd, 0412345671, 700, 7), (4, Marks, 4, 5 Fire Rd, 0412345672, 100, 1),
(5, Barr, 5, 19 Fire Rd, 0412345673, 500, 1), (6, Blok, 6, 21 Fire Rd, 0412345674, 1000, 10),
(7, Pume, 7, 21 Water Rd, 0412345675, 1000, 2), (8, Po, 8, 77 Earth Rd, 0412345676, 1000, 4),
(9, Adid, 9, 20 Earth Rd, 0412345677, 2, 200), (10, Lew, 10, 6 Earth Rd, 0412345679, 250, 1),
(11, Chia, 11, 1 Earth Rd, 0412345681, 150, 1), (12, Barrett, 12, 11 Wind Rd, 0412345682, 450, 9),
(13, James, 13, 9 Wind Rd, 0412345683, 250, 10), (14, Foop, 14, 2 Window St, 0412345684, 200, 10),
(15, Watch, 15, 8 Window St, 0412345685, 1200, 1), (16, Irving, 16, 11 Window St, 0412345686, 1400, 2),
(17, Jones, 17, 22 Window St, 0412345687, 1600, 2);
沒有你字符串用引號引起來。 '15 Water Rd'應該是''15 Water Rd'' –
那麼,一開始SQL字符串文字都用''''標記。並且,如果您不知道這一點,那麼在開始編寫SQL之前,您需要的不僅僅是一個或兩個StackOverflow答案。幫你一個忙:退後一步,閱讀語言。 –
https://mariadb.com/kb/en/library/string-literals/ –