0

I'm using the command line using standard SQL getting an error with anything I do to the database I created.

mysql> newtable
-> create table Person (Name VarChar(50) not null);
ERROR 1064 (42000): 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    'newtable'
create table Person (Name String not null)' at line 1

Any advice into what I'm doing wrong?

1
  • What is 'newtable'. Mysql does not understand that - as it says in the error Commented Mar 30, 2015 at 2:05

1 Answer 1

1

here's a sample: i guess your newtable is a database name, you need to add use prior to your database name. also use varchar if you want a string

mysql> USE YourdatabaseName
mysql> create table Person (Name Varchar(30) not null);

Here's a tutorial for creating table in mysql

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

3 Comments

When I enter the database name using 'use newtable' it returns a message saying Database Changed. I don't see this in the any of the syntax instructions because it also stops me from entering the create command since it doesn't compute that it's in the new database I'm stepping into. @Dyrandz Famador
the purpose of the use databasename is so that the mysql will know what database you are using so that the created table will be addressed to that database. can you create the table now?
you have syntax error also in you command on creating the table, use varchar instead of string, see my updated answer

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.