将sqlite3转换为mysql,但导入在phpMyAdmin中失败并产生此错误:#1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在第1行使用'PRIMARY KEY NOT NULL,sequence
VARCHAR,items_count
INTEGER,total
FLOAT,`c'附近使用正确的语法
我错过了什么?
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (`id` VARCHAR PRIMARY KEY NOT NULL ,`sequence` VARCHAR,`items_count` INTEGER,`total` FLOAT,`change` FLOAT,`tax_subtotal` FLOAT,`surcharge_subtotal` FLOAT,`discount_subtotal` FLOAT,`payment_subtotal` FLOAT,`rounding_prices` VARCHAR,`precision_prices` VARCHAR,`rounding_taxes` VARCHAR,`precision_taxes` VARCHAR,`status` INTEGER,`service_clerk` VARCHAR,`service_clerk_displayname` VARCHAR,`proceeds_clerk` VARCHAR,`proceeds_clerk_displayname` VARCHAR,`member` VARCHAR,`member_displayname` VARCHAR,`member_email` VARCHAR,`member_cellphone` VARCHAR,`invoice_type` VARCHAR,`invoice_title` VARCHAR,`invoice_no` VARCHAR,`invoice_count` INTEGER,`destination` VARCHAR,`table_no` INTEGER,`check_no` INTEGER,`no_of_customers` INTEGER,......
答案 0 :(得分:0)
SQLite和MySQL语法之间存在一些差异。
以下答案取自here
这里列出了我在两种文件格式之间所知的SQL语法的所有差异:以:
开头的行BEGIN TRANSACTION
COMMIT
sqlite_sequence
CREATE UNIQUE INDEX
MySQL中没有使用
SQLlite uses CREATE TABLE/INSERT INTO "table_name" and MySQL uses CREATE TABLE/INSERT INTO table_name
MySQL doesn't use quotes inside the schema definition
MySQL uses single quotes for strings inside the INSERT INTO clauses
SQLlite and MySQL have different ways of escaping strings inside INSERT INTO clauses
SQLlite uses 't' and 'f' for booleans, MySQL uses 1 and 0 (a simple regex for this can fail when you have a string like: 'I do, you don\'t' inside your INSERT INTO)
SQLLite uses AUTOINCREMENT, MySQL uses AUTO_INCREMENT
上述链接有助于解决此问题。