theratkeeper
theratkeeper

Reputation: 77

MySQL not creating table, keeps reporting syntax error which doesn't exist

I am trying to create a table in a MySQL database. I am using the command line of my server. I input:

test1;
CREATE TABLE people (ID int, name varchar(40));

...and it says:

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 'CREATE TABLE people (ID int, name varchar(40)); at line 1

I am very confused. I have even tried copy-pasting working examples of code, and I get the same result every time. Thank you for your help.

Upvotes: 1

Views: 60

Answers (1)

Umutambyi Gad
Umutambyi Gad

Reputation: 4101

first of all create database with the following syntax CREATE DATABASE DATABASE_NAME select the database like USE DATABASE_NAME then create table and the keyword in uppercase CREATE TABLE people (Id INT, name VARCHAR(40)); or CREATE TABLE IF NOT EXISTS people (Id INT, name VARCHAR(40));

Upvotes: 1

Related Questions