Mysql Error Create Table 1064
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might error 1064 mysql 42000 create table have Meta Discuss the workings and policies of this site About
Error 1064 Mysql 42000 Create Database
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting error 1064 (42000): you have an error in your sql syntax; ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million mysql error 1064 42000 programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL Create Table Error 1064 up vote 0 down vote favorite I am trying to create a table in MySQL but it doesn't want to play: create table traders( traderID INT(9) ZEROFILL NOT NULL AUTO_INCREMENT UNSIGNED, traderProfileName VARCHAR(64) NOT
Create Table Mysql
NULL, traderPassword CHAR(128) NOT NULL, traderFirstName VARCHAR(40) NOT NULL, traderSurname VARCHAR(40) NOT NULL, traderContactPhone VARCHAR(14) NOT NULL, locationPostCode CHAR(4) NOT NULL, traderEmail VARCHAR(120) NOT NULL, traderBio VARCHAR(255) DEFAULT NULL, traderReviewRating DECIMAL(5,2) DEFAULT NULL, traderLastLogin DATETIME DEFAULT NULL, PRIMARY_KEY(traderID) ); And I am getting 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 'UNSIGNED, traderProfileName VARCHAR(64) NOT NULL, traderPassword CHAR(128) NOT ' at line 2" Is this something simple as I am using incorrect parameters for the table settings? mysql database share|improve this question edited May 29 at 15:46 wogsland 2,84181235 asked Oct 14 '13 at 19:27 Jonlee 1614 also unsigned is not a valid mysql type. Read the manual ! You have an invalid type and a typo. –Lorenz Meyer Feb 3 '15 at 9:16 add a comment| 4 Answers 4 active oldest votes up vote 0 down vote Auto increme
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn mysql create table example more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL error 1064 creating table up vote 1 down vote favorite Trying to create a table with two foreign keys and keep getting this error: #1064 - http://stackoverflow.com/questions/19367752/mysql-create-table-error-1064 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 'idbed MEDIUMINT UNSIGNED NOT NULL, idnumber MEDIUMINT UNSIGNED NOT NULL,' at line 2 The table is: CREATE TABLE care( idbed MEDIUMINT UNSIGNED NOT NULL, idnumber MEDIUMINT UNSIGNED NOT NULL, PRIMARY KEY(idbed, idnumber), FOREIGN KEY(idbed) REFERENCES intensivecarebed(idbed) FOREIGN KEY(idnumber) REFERENCES employee(idnumber)); the other two tables are: CREATE TABLE Employee( first_name VARCHAR(30) NOT http://stackoverflow.com/questions/28067915/mysql-error-1064-creating-table NULL, last_name VARCHAR(30) NOT NULL, address VARCHAR(60) NOT NULL, salary FLOAT UNSIGNED NOT NULL, specialization VARCHAR(50) NOT NULL< clinic_name VARCHAR(50) NOT NULL, PRIMARY KEY(idnumber) ); CREATE TABLE intensivecarebed( idbed MEDIUMINT UNSIGNED NOT NULL, clinic_name VARCHAR(50) NOT NULL, tax_reg_number TINYINT(10) UNSIGNED NOT NULL, PRIMARY KEY(idbed) ); Anybody insights? mysql sql mysql-error-1064 share|improve this question edited Jan 21 '15 at 13:31 rtruszk 3,408132242 asked Jan 21 '15 at 13:02 Ioanna Otinanai 83 Ther is some syntax error in the following line: specialization VARCHAR(50) NOT NULL< < should be replaced by ',' in the first create After correcting this syntax error, i executed this sccript in my MySQL server it went ok... –ASNAOUI Ayoub Jan 21 '15 at 13:09 specialization VARCHAR(50) NOT NULL< one < which must be ,. Don't you need idnumber MEDIUMINT UNSIGNED NOT NULL, also in table Employee? –Jason Paddle Jan 21 '15 at 13:10 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted There are several errors in your code: You missed idnumber in Employee table. You missed coma between foreign keys. You had < instead of , You also have to create care table after creating other two tables because you are referring to these tables. Try this: CREATE TABLE Employee( idnumber MEDIUMINT UNSIGNED NOT NULL, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL, address VARCHAR
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the http://askubuntu.com/questions/469847/error-1064-42000-creating-table-mysql company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top ERROR 1064 (42000) creating table MySQL up create table vote 0 down vote favorite I try to build my own website, and at my website I ask people to enter their name and write a little story. When they are done, they hit submit, and it sends the information to my database. I work with MySQL, and I want to create a table where I can store the information in. This is my MySQL code:+ CREATE TABLE names ( name PRIMARY KEY NOT NULL, error 1064 mysql message NOT NULL, IPv4 NOT NULL, browser NOT NULL, date NOT NULL, time NOT NULL, ); But when I enter this in my command prompt, it says: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 'PRIMARY KEY NOT NULL, message NOT NULL, IPv4 NOT NULL, browser NOT NULL, date NO' at line 1Can you tell me what I did wrong and how to fix this? I don't know if it's helpful, but I've encluded my PHP script too. It can be a little messy with names because I had to translate the variables to English. My PHP code is (I created it before I created the table, and as you see I did manage to set up my database 'names', also I want to call my table 'names'):
$name = $_POST['name']; $message = $_POST['message']; $user = 'user'; $password = 'Login'; $host = 'localhost:3036'; $browser = $_SERVER['HTTP_USER_AGENT']; $ip = $_SERVER["REMOTE_ADDR"]; date_default_timezone_set('UTC+1'); $date = date("Y-m-d"); $time = date("H:i:s"); $connect = mysql_connect($host, $user, $password); if (! $connect) { $error = mysql_error(); print "Sorry, could not connect: $error"; } print "Connected!"; $database = "USE names"; $table = "INSERT INTO names (name, message, IPv4, browser, date, time) VALUES ($name, $message, $ip, $browser, $date, $time)"; if (! $database) { $error=mysql_err