Search code examples
mysqlmysql-error-1064

MySQL said: Documentation #1064


I got this error and it's drive me crazy can anyone help please MySQL said: Documentation

#1064 - 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 'Fermentum Street’, 'Balvano', 'P5 4MR', 06925697768, 04675467216, 'pure@commod' at line 4

here is the code:

DELETE FROM Branch;

INSERT INTO Branch
(branchNo, street, city, postcode, telNo, faxNo, email) values

('B001', ’7 Fermentum Street’, 'Balvano', 'P5 4MR', 06925697768, 04675467216, '[email protected]'),
('B002', '66 Rutrum Road’, ’Cropalati', 'WZ5 8BZ', 06061881811, 01762692460, '[email protected]'),
('B003', '21 Fast Road', ‘Manchester’, ’MV3 3AG', 01069686611, 02161256151, '[email protected]'),
('B004', '89 Eros Road’, ’Campano', 'C5K 1AY', 04713509428, 08683205705, '[email protected]'),
('B005’, ’21 Harbour Road’, ’Portsmouth’, ’BS2 7AJ’, 01234567890, 01234567891, ’[email protected]’),
('B006', '57 Lectus Street', 'Stornaway', 'B6 5CQ', 03451135340, 04667526884, '[email protected]'),
('B007', '1 Dictum’, ’Freetown’, 'FP6 6DB', 02158833092, 03471665376, '[email protected]’),
('B008’, '32 Site’, ’Williams Lake', 'R8X 4CZ', 07988177200, 02359143354, '[email protected]’),
('B009’, '84 Felis Road’, ’France’, ’FD9 8EB', 08233247583, 06991371955, '[email protected]’),
('B010’, '29 Nascetur Road', 'Archennes', 'X4 7ZZ', 00073470059, 00146946683, '[email protected]’),
('B011’, '21 Sed Street’, ’Senftenberg', 'I3X 1JA', 03175544001, 03303607701, '[email protected]’),
('B012’, '36 Arcu Road', ‘Damam’, ’DN0 7ZL', 00748620378, 04347090006, '[email protected]’),
('B013’, '87 Vitae street’, ’Cerchio', 'D8C 3WL', 07850220231, 09407309996, '[email protected]’),
('B014’, '61 Duis Street’, ’Rio', 'WB1 1KF', 04272972336, 03780916592, '[email protected]’),
('B015’, '4 Vestibulum Road', 'Stony', 'SO5P 3SL', 03066416104, 06798350690, '[email protected]');

Solution

  • In Mysql, strings are always delimited with '. You have some occurrences of or .

    Replace all those with ' and your insert will be successful:

    INSERT INTO Branch(branchNo, street, city, postcode, telNo, faxNo, email) values
      ('B001', '7 Fermentum Street', 'Balvano', 'P5 4MR', 06925697768, 04675467216, '[email protected]'),
      ('B002', '66 Rutrum Road', 'Cropalati', 'WZ5 8BZ', 06061881811, 01762692460, '[email protected]'),
      ('B003', '21 Fast Road', 'Manchester', 'MV3 3AG', 01069686611, 02161256151, '[email protected]'),
      ('B004', '89 Eros Road', 'Campano', 'C5K 1AY', 04713509428, 08683205705, '[email protected]'),
      ('B005', '21 Harbour Road', 'Portsmouth', 'BS2 7AJ', 01234567890, 01234567891, '[email protected]'),
      ('B006', '57 Lectus Street', 'Stornaway', 'B6 5CQ', 03451135340, 04667526884, '[email protected]'),
      ('B007', '1 Dictum', 'Freetown', 'FP6 6DB', 02158833092, 03471665376, '[email protected]'),
      ('B008', '32 Site', 'Williams Lake', 'R8X 4CZ', 07988177200, 02359143354, '[email protected]'),
      ('B009', '84 Felis Road', 'France', 'FD9 8EB', 08233247583, 06991371955, '[email protected]'),
      ('B010', '29 Nascetur Road', 'Archennes', 'X4 7ZZ', 00073470059, 00146946683, '[email protected]'),
      ('B011', '21 Sed Street', 'Senftenberg', 'I3X 1JA', 03175544001, 03303607701, '[email protected]'),
      ('B012', '36 Arcu Road', 'Damam', 'DN0 7ZL', 00748620378, 04347090006, '[email protected]'),
      ('B013', '87 Vitae street', 'Cerchio', 'D8C 3WL', 07850220231, 09407309996, '[email protected]'),
      ('B014', '61 Duis Street', 'Rio', 'WB1 1KF', 04272972336, 03780916592, '[email protected]'),
      ('B015', '4 Vestibulum Road', 'Stony', 'SO5P 3SL', 03066416104, 06798350690, '[email protected]');
    

    sqlfiddle demo