1 Replies - 398 Views - Last Post: 04 December 2016 - 06:37 AM

#1 sadboys  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-August 15

Error in SQL Query - Creating Table

Posted 04 December 2016 - 05:13 AM

I'm trying to create a database for my mobile application, suddenly it gives me a error in my SQL code.

Here's my CREATE TABLE query:

CREATE TABLE `apc` (
  `id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `id_number` varchar(64) NOT NULL,
  `email` varchar(64) NOT NULL,
  `department` int(11) NOT NULL,
  'hours' int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1


I'm getting an error in 'hours', it says "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''hours' int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1' at line 7"

I'm using the correct syntax I don't know why it gives me an error. Can you guys help me out?



EDIT: Oh never mind I get it now, what a silly mistake. Moderators please delete my question.

This post has been edited by sadboys: 04 December 2016 - 05:14 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Error in SQL Query - Creating Table

#2 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,565
  • Joined: 12-December 12

Re: Error in SQL Query - Creating Table

Posted 04 December 2016 - 06:37 AM

We don't delete topics as per the forum rules. I see that you switched from backticks to apostrophes (as the colour-coding also indicates). This information is likely to be useful to others in the future who do the same thing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1