mysqlsqllaraveltable-plus

Error when using AUTO_INCREMENT in TablePlus


I was following a tutorial for Laravel and this course required me to use TablePlus. I had to create a table with a given query, but it's not working and I am not completely sure as to why it's not working.

Here is the query I am using

CREATE TABLE users {
    `id` INT NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(100) NOT NULL,
    `email` VARCHAR(100) NOT NULL,
    PRIMARY KEY (id) 
};

In the tutorial I am following "Auto_Increment" is highlighted blue, but with me it's just the standard white.

And this is the error I receive when I try to run this query.

Query 1: 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` INT NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(100) NOT NULL,
    `email` VAR' at line 1

I would appreciate it if someone could tell me why this is happening as it is something that Google doesn't have answer to.


Solution

  • I think you are making an error using {} TRY:

    CREATE TABLE users (
        `id` INT NOT NULL AUTO_INCREMENT,
        `name` VARCHAR(100) NOT NULL,
        `email` VARCHAR(100) NOT NULL,
        PRIMARY KEY (id) 
    );
    

    Or is it because of laravel? I am not sure about laravel