Error creating table in SQL [closed]

2019-09-02 03:37发布

I keep getting errors when running this query in phpmyadmin to create a customers table for my database.

This is the query I am trying to use:

CREATE TABLE customers (
cust_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name character(30),
phone character(15),
);

Any help would greatly appreciated.

2条回答
冷血范
2楼-- · 2019-09-02 04:12

You added a comma after phone character(15)

Try this:

CREATE TABLE customers (
cust_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name character(30),
phone character(15)
);
查看更多
萌系小妹纸
3楼-- · 2019-09-02 04:20

no need to put a comma for last column.

Remove comma after phone character(15).

Try this

CREATE TABLE customers (
cust_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name character(30), 
phone character(15)
); 
查看更多
登录 后发表回答