user3175137
user3175137

Reputation: 97

SQL error on ubuntu command line

I am working with a SQL database on a Ubuntu LAMP server. I am attempting to create a new database then a new table in it, which can hold blobs. I can login, create my database, use it, but then I cannot create the table. I am doing:

$mysql -u root -p mypass
mysql> use frame;
Database changed
mysql> create table 'frame_info' ( 'frame_data' BLOB NOT NULL, 'frame_name' VARCHAR(45) NULL, 'creator_name' VARCHAR(45) NULL, PRIMARY KEY ('frame_data'));

From there, I get the error:

ERROR 1064 (4200): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to user near ''fram
e_info' ( create table 'frame_info' ( 'frame_data' BLOB NOT NULL, 'frame_na' at 
line 1

Obviously that error is truncated by the mysql display, but you get the gist.

Upvotes: 0

Views: 234

Answers (1)

potashin
potashin

Reputation: 44601

You should use backticks ` instead of single quotes ' or (in your case) you can succeed without them at all :

 create table `frame_info` (
     `frame_data` BLOB NOT NULL,
     `frame_name` VARCHAR(45) NULL,
     `creator_name` VARCHAR(45) NULL,
      PRIMARY KEY (`frame_data`)
 );

Upvotes: 1

Related Questions