我正在尝试在SQL
中创建一个临时表,但是有一个我无法识别的错误。
CREATE TEMPORARY TABLE Guest(ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
ticket_id NOT NULL VARCHAR(255),
event_id NOT NULL INT (11),
user_id NOT NULL INT (11),
fullname NOT NULL VARCHAR(255),
delivery NOT NULL VARCHAR(255),
ticket_type NOT NULL VARCHAR(255),
ticket_price NOT NULL DECIMAL(19,4),
fees NOT NULL DECIMAL(19,4),
total_price NOT NULL DECIMAL(19,4),
barcode NOT NULL VARCHAR(255),
purchase_time NOT NULL datatime,
person_pickup NOT NULL varchar(80),
Qty NOT NULL INT(11));
这是错误消息:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'NOT NULL VARCHAR(255),event_id NOT NULL INT (11),user_id NOTNULL INT (11),fulln' at line 1
最佳答案
1-在字段类型后放置“ NOT NULL”:
CREATE TEMPORARY TABLE Guest(ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
ticket_id VARCHAR(255) NOT NULL,
event_id INT (11) NOT NULL,
user_id INT (11) NOT NULL,
fullname VARCHAR(255) NOT NULL,
delivery VARCHAR(255) NOT NULL,
ticket_type VARCHAR(255) NOT NULL,
ticket_price DECIMAL(19,4) NOT NULL,
fees DECIMAL(19,4) NOT NULL,
total_price DECIMAL(19,4) NOT NULL,
barcode VARCHAR(255) NOT NULL,
purchase_time datetime NOT NULL,
person_pickup varchar(80) NOT NULL,
Qty INT(11) NOT NULL);
2-您在“ DATETIME”输入错误
关于mysql - 有人可以帮我看看这个SQL查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32403222/