2

I want to import an SQL file to my phpMyAdmin database, the file contains tables about a restaurant application and a table about the admin login, but I have 2 unexpected errors, I really don't see what is exactly wrong with that?. here is the error message:

2 errors were found during analysis.

An opening bracket followed by a set of values was expected. (near "CREATE" at position 109)
Unexpected token. (near "CREATE" at position 109)
SQL query:

INSERT INTO `adminlogin` (`id`, `Username`, `Password`, `right`) VALUES (1, '[email protected]', '123', 1), CREATE TABLE IF NOT EXISTS `tbl_food` ( `id` int(11) NOT NULL AUTO_INCREMENT, `food_type` varchar(50) NOT NULL, `food_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1

MySQL said: Documentation

#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 'CREATE TABLE IF NOT EXISTS `tbl_food` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
' at line 6

and here is the two tables that show errors. Any insight on that? thank you

CREATE TABLE IF NOT EXISTS `adminlogin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Username` varchar(100) NOT NULL,
  `Password` varchar(50) NOT NULL,
  `right` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `adminlogin`
--

INSERT INTO `adminlogin` (`id`, `Username`, `Password`, `right`) VALUES
(1, '[email protected]', '123', 1),

-- --------------------------------------------------------

--
-- Table structure for table `tbl_food`
--

CREATE TABLE IF NOT EXISTS `tbl_food` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `food_type` varchar(50) NOT NULL,
  `food_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

1 Answer 1

1

You have a comma at the end of INSERT statement, instead of semicolon.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.