Error creating table in SQL [closed]

▼魔方 西西 提交于 2020-01-17 02:54:25

问题


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.


回答1:


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



回答2:


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


来源:https://stackoverflow.com/questions/30538823/error-creating-table-in-sql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!