MySQL syntax error when creating a lab test table -


i learning simple sql create database of lab tests in mysql. syntax can found below. keep getting an error code 1064 (42000) , cannot figure out why:

mysql> create table xiao (level char (1), fullname varchar (50), name varchar (50), basecode varchar (20),  loinc curation varchar (10), primary key (loinc curation) ); 

the error code tells me

check syntax use near curation varchar (10), primary key (loinc curation))

you can't have space in name that. loinc curation loinccuration or loinc_curation...

if want include spaces in fieldnames, surround them backticks like:

create table xiao (level char (1), fullname varchar (50), name varchar (50),  basecode varchar (20), `loinc curation` varchar (10),  primary key (`loinc curation`) ); 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -