Skip to content
Advertisement

“a symbol name was expected” error trying to create a table in phpMyAdmin

I am trying to create a table in a database in phpMyAdmin and I keep getting the “a symbol name was expected” error and I cannot figure out what is going on. Is my syntax wrong? I am new to this and I’m at a loss.

Create Table Query

Advertisement

Answer

Column names, table names should be surrounded by backticks(``)

CREATE TABLE IF NOT EXISTS `sales` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    `item` varchar(50) NOT NULL,
    `date` varchar(50) NOT NULL,
    `amount` int(11) NOT NULL,
    PRIMARY KEY (`id`)
)

Or you can go without backticks as well:

CREATE TABLE IF NOT EXISTS sales (
    id int(11) NOT NULL AUTO_INCREMENT,
    name varchar(50) NOT NULL,
    item varchar(50) NOT NULL,
   date varchar(50) NOT NULL,
   amount int(11) NOT NULL,
   PRIMARY KEY (id)
)
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement