I'm trying to create my database for a website and there seems to be an error I cannot solve. For some reason it's giving me an invalid syntax problem, but I have no idea why. I looked it up everwhere.
mysql> SELECT WebsiteDB
-> CREATE Table `MasaTable`(
-> `Username` varchar(255),
-> `Password` varchar(255),
-> `Email` varchar(255)
-> );
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 'CREATE Table `MasaTable`(
`Username` varchar(255),
`Password` varchar(255),
`' at line 2
I have no idea why it's pointing at line two. Any ideas?
Thanks in advance!
EDIT: Well thats odd, I just tried out my code in SQL Fiddle and it seemed to work. What could be the problem? I'm doing this through the MySQL Server 5.7 Command line client...
Oh boy, was that a stupid mistake.
I was using SELECT <database>
instead of USE <database>
, and I wasn't closing it with a semicolon. Thank you Mihai!
This works just fine:
USE WebsiteDB;
CREATE Table MasaTable( Username varchar(255), Password varchar(255), Email varchar(255));