0

CREATE TABLE `employee`(`employee_no` CHAR(4) NOT NULL,`emp_name` TEXT,`employee_sal` INT NOT NULL,primary key (employee_no); << I typed this and it says there is an error (see below).I can't see what is it.000webhost.com Mysql server

Error
SQL query:

CREATE TABLE `employee` (

`employee_no` CHAR( 4 ) NOT NULL ,
`emp_name` TEXT,
`employee_sal` INT NOT NULL ,
PRIMARY KEY ( employee_no )
MySQL said: 

#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 '' at line 1
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by silvercats
0

Also I have another question ,If use VARCHAR ,we can only put integers?
what is the difference between CHAR and VARCHAR?why shouldn't I sue INT and STRING instead of them?

1

You were missing an ending parenthesis.

CREATE TABLE `employee` (
 
`employee_no` CHAR( 4 ) NOT NULL ,
`emp_name` TEXT,
`employee_sal` INT NOT NULL ,
PRIMARY KEY ( employee_no )
)

Look at MySQL Manual for string data types. Post back here if you have any question after reading the provided link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.