简体   繁体   中英

Where is the syntax error in this piece of sql code I wrote in themysql workbench?

This is a very simple piece of code using which I am trying to create a table of an entity Bank.

create table bank (
banknum integer(5) NOT NULL,
bankname varchar(20) NOT NULL,
primary key(banknum));

However, executing this gives an error:

Error Code: 1064 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 'create table bank ( banknum integer(5) NOT NULL, bankname varchar(20) NOT NULL, ' at line 1

I do not understand where this syntax error is occurring.

create table bank (
banknum INT(5) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
bankname VARCHAR(20) NOT NULL);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM