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

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?

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.

yup.that is stupid ...thanks for the answer!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.