create table command doesn't work

I have a new installed mysql server. when i tried to run the following command, it gave me error as below, please help.

mysql> create table student(
    ->     -> fist_name varchar(30) not null,
    ->     -> last_name varchar(30) not null,
    ->     -> email varchar(60) null,
    ->     -> street varchar(50) not null,
    ->     -> city varchar(40) not null,
    ->     -> state char(2) not null default "CA",
    ->     -> zip mediumint unsigned not null,
    ->     -> phone varchar(20) not null,
    ->     -> birth_date DATE not null,
    ->     -> sex enum('M','f') not null,
    ->     -> date_entered timestamp,
    ->     -> lunch_cost float null,
    ->     -> student_id int unsigned not null auto_increment primary key
    -> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre                                                t syntax to use near '-> fist_name varchar(30) not null,
    -> last_name varchar(30) not null,
    ->' at line 2
Jason YuAsked:
Who is Participating?
 
Daniel WilsonCommented:
It looks like you copied in too many tabs.  More than 1 tab per line causes problems.  Delete a bunch of those in your text editor and paste in the script again.

And while you're at it ... you may mean first_name instead of fist_name.
0
 
Haris DulicCommented:
Hi,

when you remove -> then the syntax is ok.. Here is the code that works
 create table student(
          fist_name varchar(30) not null,
          last_name varchar(30) not null,
          email varchar(60) null,
          street varchar(50) not null,
          city varchar(40) not null,
          state char(2) not null default "CA",
          zip mediumint unsigned not null,
          phone varchar(20) not null,
          birth_date DATE not null,
          sex enum('M','f') not null,
          date_entered timestamp,
          lunch_cost float null,
          student_id int unsigned not null auto_increment primary key
     );

Open in new window


You can check it here http://sqlfiddle.com/#!9/1d3af/1 just Build the schema
0
 
Jason YuAuthor Commented:
got it, after I copied your code, it worked now.
0
 
Jason YuAuthor Commented:
great answer, thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.