In my Navicat Premium:
I run the below code in Query Editor:
CREATE TABLE employee(
id INT AUTO_INCREMENT PRIMARY KEY,
empName VARCAHR(20),
deptName VARCAHR(20)
);
But I get the error:
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 'AUTO_INCREASE PRIMARY KEY, empName VARCAHR(20), deptName VARCAHR(20)
)' at line 2
You have syntax error cause it is AUTO_INCREMENT
not AUTO_INCREASE
Change this:
CREATE TABLE employee(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
empName VARCHAR(20),
deptName VARCHAR(20)
);
You can also create table and involve primary key second way
CREATE TABLE employee(
id INT NOT NULL AUTO_INCREMENT ,
empName VARCHAR(20),
deptName VARCHAR(20),PRIMARY KEY(id)
);