mysql - ERROR 1064 (42000), wenn Sie Schlüsselwörter als Spaltennamen
Was ist daran falsch?
Diese lief erfolgreich auf einem Gentoo-system, aber jetzt auf einem Debian-Squeeze (Raspberry PI) funktioniert es nicht.
Datenbank-setup ist in Ordnung
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| arduino1 |
| mysql |
| performance_schema |
| test |
| tmp |
+--------------------+
6 rows in set (0.01 sec)
mysql>
Befehl:
#mysql -u root -p******* arduino1 < arduino-tables.sql
Ergibt:
ERROR 1064 (42000) at line 1: 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 '(8),
currentTime DATETIME,
timeDiff INT(10),
unixTime INT(10),
currentR1 FL' at line 3
Inhalt des arduino-Tabellen.sql:
#cat arduino-tables.sql:
CREATE TABLE pulseLog (
id INT(10) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
timeStamp TIMESTAMP(8),
currentTime DATETIME,
timeDiff INT(10),
unixTime INT(10),
currentR1 FLOAT,
currentS2 FLOAT,
currentT3 FLOAT,
currentAverageR1 FLOAT,
currentAverageS2 FLOAT,
currentAverageT3 FLOAT,
temp0 FLOAT,
temp1 FLOAT,
temp2 FLOAT,
temp3 FLOAT,
temp4 FLOAT,
temp5 FLOAT,
pulses INT,
event char(255),
) CHARACTER SET UTF8;
InformationsquelleAutor jonsag | 2012-09-11
Du musst angemeldet sein, um einen Kommentar abzugeben.
Dort, wo einige typo-Fehler, wie
timestamp
ist ein wichtiges Wort, Sie hatten einen extra-Komma nachevent char(255),
.Versuchen Sie dies:
Hier ist die SQL Fiddle DEMO
Edit:
Abgesehen davon, dass Ihre syntax timestamp nicht unterstützt wurde.
Für Referenz, die auf Datum, datetime-und timestamp - überprüfen Sie hier
InformationsquelleAutor heretolearn
Sie Keywords verwenden, die einen
datatype
. Sie können tun, dass durch die Flucht es mitbacktick
BeispielInformationsquelleAutor John Woo