我无法解决数据库中的错误 [英] I cant solve error in database

查看:66
本文介绍了我无法解决数据库中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:





create table Ticket (
ticket_id integer not null primary key,
AirlineName varchar not null,
CustomerName varchar,
fromCity varchar,
toCity varchar,
fltNo integer,
TicketDate date,
Dtime TIME,
Atime time,
price integer);

请帮助我,我找不到错误。
程序是我的sql,这就是错误

Please help me, I can't find the error. the program is my sql, and this is the error

您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在不为null,
CustomerName varchar,
fromCity varchar,
toCity varchar,
fltNo inte附近使用第3行

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 'not null, CustomerName varchar, fromCity varchar, toCity varchar, fltNo inte' at line 3

推荐答案

现在我知道它是MySQL:

Now that I know it's MySQL:

您的varchars应该有长度(并且phpMyAdmin似乎使用INT而不是整数,但两者似乎都有效)

Your varchars should have lengths (and phpMyAdmin appears to use INT instead of integer, but both seem to be valid)

CREATE TABLE Ticket(
ticket_id INT PRIMARY KEY ,
AirlineName VARCHAR( 255 ) NOT NULL ,
CustomerName VARCHAR( 255 ) ,
fromCity VARCHAR( 255 ) ,
toCity VARCHAR( 255 ) ,
fltNo INT,
TicketDate DATE,
Dtime TIME,
Atime TIME,
price INT
);

这篇关于我无法解决数据库中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆