Reputation: 808
I have a problem with MySQL.
I had successfully set up MySQL, as well as created a database (named "Users").
I am able to CREATE DATABASE
(such as the one named "Users"), but when I'm onto creating tables using the command CREATE TABLE
, MySQL returns the statement:
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 'NOT NULL, password NOT NULL)' at line 2
Here's my code:
-- First, I'll set the database to "Users":
USE users
-- Then, I'll make a table within the database Users:
CREATE TABLE users (
user NOT NULL,
password NOT NULL
);
Upvotes: 1
Views: 336
Reputation: 2692
Your syntax for creating a table in MySQL
is not correct. You have to provide the data type for every column
you create inside a table
, Like if your user and password is varchar
type then:
CREATE TABLE users (
user VARCHAR(30) NOT NULL,
password VARCHAR(30) NOT NULL
);
Also read link for reference.
Upvotes: 7
Reputation: 216
You miss the data type for your columns, try this one (obviously you can change the column type as for your requirements):
CREATE TABLE users (
user VARCHAR(24) NOT NULL,
password VARCHAR(24) NOT NULL
);
Upvotes: 1