I have mistake in database

2019-03-07 18:05发布

问题:

When creating a table as follows

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);

I get the following error:

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

What might cause this and how to I solve it?

回答1:

create table Ticket (
ticket_id INT NOT NULL 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);