I am trying to create a MySQL table with the following code:
CREATE DATABASE
IF NOT EXISTS myusers;USE
DROP TABLE
DROP TABLE IF EXISTS `myusers`.`users`;CREATE TABLE `myusers`.`users`
(
`username` VARCHAR(45) NOT NULL,
`password` VARCHAR(45) NULL,
`firstname` VARCHAR(45) NOT NULL,
`lastname` VARCHAR(45) NULL,
`phone` INT NULL,
PRIMARY KEY (`username`)
)
However, I am getting this error:
ERROR 1064 (42000): 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 'DROP TABLE DROP TABLE IF EXISTS
myusers.users' at line 2
I have limited knowledge of MySQL. From what I know about SQL syntax this looks fine.
Any idea what could be the issue here?
CREATE DATABASE <name needed here>. Then you haveIF NOT EXISTS myusers;USEwhich seems to make no sense. etc, etc. The only advice I can give is to read the manual and actually look up the syntax for each individual command you're trying to write....