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?

2
  • 2
    Works for me Commented May 29, 2013 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 ). Commented May 29, 2013 at 19:43

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.