2

I'm trying to run the following command:

CREATE TABLE artist
(
    aid INT PRIMARY KEY AUTO_INCREMENT,
    fname VARCHAR(30) NOT NULL,
    lname VARCHAR(40),
    dob DATE,
    gender CHAR(1)
);

I've tried putting it all on one line. I've tried messing with capitalization, and I get the same error message which is

-bash: syntax error near unexpected token `('

Any ideas what I'm doing wrong?

Leigh
  • 28,605
  • 10
  • 52
  • 98
TSI25
  • 37
  • 1
  • 6
  • 2
    [Works for me](http://sqlfiddle.com/#!2/919cd) – juergen d May 29 '13 at 19:41
  • Welcome to Stack Overflow. With database questions, it is a good idea to also include your database type and version in the tags. I updated the question tags to include `MySQL`. If that is incorrect, please [update them](http://stackoverflow.com/posts/16822425/edit) ). – Leigh May 29 '13 at 19:43

1 Answers1

4

You have to execute this command in the database (not from the command line).

For example, if you are using MySQL, you have to login to the database first:

$ mysql -u root -p

then enter the password. You'll see a welcome screen and a mysql> prompt:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 3.23.28-gamma-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql>

Type CREATE TABLE command after the mysql> prompt.

Community
  • 1
  • 1
Yang
  • 7,312
  • 7
  • 45
  • 64