This seems a fairly trivial problem but I am having no luck in running the following query:
create table if not exists tweet_data (
created_at DATETIME,
user_name VARCHAR(20),
retweet_count INT,
favourite_count INT,
tweet_followers_count INT,
is_retweet BOOLEAN,
tweet_source VARCHAR(256),
user_location VARCHAR(256),
tweet_mentioned_count INT,
tweet_ID VARCHAR(256) NOT NULL,
tweet_text VARCHAR(140),
UNIQUE (tweet_ID) );
When I run this I get the following error message:
Error Code: 1064. 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 '(20), retweet_count INT, favourite_count INT,
tweet_followers_count ' at line 3
When I hover over the error tag on line 3 it says:
Syntax error : unexpected '(' (opening parenthesis)
I'm sure this is a simple fix, any help would be great!
Turned out to be an error with mySQL Workbench
create table if not exists tweet_data (
created_at DATETIME,
user_name VARCHAR (20),
retweet_count INT,
favourite_count INT,
tweet_followers_count INT,
is_retweet BOOLEAN,
tweet_source VARCHAR(256),
user_location VARCHAR(256),
tweet_mentioned_count INT,
tweet_ID VARCHAR(256) NOT NULL,
tweet_text VARCHAR(140),
UNIQUE (tweet_ID) );
Man this code is running perfectly.
go to this link and check it your self
http://rextester.com/l/mysql_online_compiler
Related
I'm trying to create a table Order but somehow I am encountering the error code below:
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 'Order(
OrderId int,
CustId int,
OrderDate datetime,
RequiredDate datetime,
Shipp' at line 1
I use the following code to create my table:
create table Order(
-> OrderId int,
-> CustId int,
-> OrderDate datetime,
-> RequiredDate datetime,
-> ShippedDate datetime,
-> Status varchar(12),
-> Comments varchar(255)
-> );
We don't need to set primary key or foreign key but I don't know what went wrong with my code. Please advice thanks!
Thanks #jarlh I didn't know it was a reserve word. I just started SQL.
Im trying to run the following from the mysql shell client:
MySQL localhost:33060+ ssl plaything SQL > CREATE TABLE areas (id SERIAL PRIMARY KEY, area_name VARCHAR);
and keep getting the following error:
ERROR: 1064: 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 ')' at line 1
where could I be going wrong?
solved by yoss:
try this: CREATE TABLE areas ( id int NOT NULL AUTO_INCREMENT, area_name varchar(255), PRIMARY KEY (id) );
varchar did not have number of characters specified in the original statement
I am attempting to run a sql file on a mysql at this address
https://github.com/articDrag0n/PrepApp/blob/master/sql/create_tables.sql
and I am getting an error
ERROR 1064 (42000) at line 20: 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 '(ID)
)' at line 11
How do I fix this
It is not your version. There is an error in the script. The create offerings should read (comma was missing after icon VARCHAR(255)):
DROP TABLE IF EXISTS offerings;
CREATE TABLE offerings(
id int NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
moderator TEXT,
moderator_email TEXT,
description TEXT,
location TEXT,
peopleLimit INT,
days TEXT,
icon VARCHAR(255),
PRIMARY KEY (ID)
);
I have the following query for creating a table in my database but I am getting an error:
CREATE TABLE student (
accountNumber INT NOT NULL PRIMARY KEY,
firstName CHAR(20),
lastName CHAR(20),
courseID VARCHAR(6),
grade DOUBLE(3)
)
The error I am getting is:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 1
You dont need NOT NULL if declaring a Primary Key...because that key always needs to be available
I get an error when running the following create table:
CREATE TABLE Event (
id VARCHAR(10) NOT NULL,
title VARCHAR(100),
start_date DATE NOT NULL,
end_date DATE,
description TEXT,
url VARCHAR(200),
website VARCHAR(200),
location VARCHAR(32) NOT NULL;
PRIMARY KEY (id),
FOREIGN KEY (location) REFERENCES Location(id)
);
The error I get is this:
#1064 - 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 '' at line 9
I know that this error has to do with incompatibility with the syntax and the mysql version running, but I've checked every line and the syntax is correct according to the documentation. Am I missing something?
Thanks in advance for all your answers.
Try changing the semicolon on line:
location VARCHAR(32) NOT NULL;
to a comma.