Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Syntax error creating a table in my database

I’m getting error after trying to create a table for my data base

This is my script

CREATE TABLE `users` (
  `id` int PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `user_role_id` int NOT NULL,
  `first_name` varchar(250) NOT NULL,
  `last_name` varchar(250) NOT NULL,
  `name` varchar(250),
  `email` varchar(250) NOT NULL,
  `dni_type` varchar(32) NOT NULL,
  `dni` int NOT NULL,
  `phone` int,
  `address` varchar(250),
  `city` varchar(125),
  `state` varchar(125),
  `country` varchar(32),
  `zip` varchar(32),
  `created_at` datetime,
  `created_by` int,
  `updated_at` datetime,
  `updated_by` int,
  `deleted_at` datetime,
  `deleted_by` int
);

I’m getting

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#1064 - Something is wrong in your syntax near 'CREATE TABLE `users` (
  `id` int PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `u...' on line 2

Why is the error generated, and how can I avoid it in the future?

>Solution :

CREATE TABLE users (
id int PRIMARY KEY NOT NULL AUTO_INCREMENT

Don’t use `

CREATE TABLE users (
id int PRIMARY KEY NOT NULL AUTO_INCREMENT

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading