Mysql Error 1064 Create Table
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
Error 1064 Mysql 42000 Create Table
workings and policies of this site About Us Learn more about error 1064 mysql 42000 create database Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions error 1064 (42000): you have an error in your sql syntax; 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.
Mysql Error 1064 42000
Join them; it only takes a minute: Sign up Syntax error 1064 in CREATE TABLE statement with TINYTEXT columns? up vote 0 down vote favorite This is the MySQL code I have so far: CREATE DATABASE bankbase; USE bankbase; CREATE TABLE clienttable( ClientID SMALLINT(15) NOT NULL DEFAULT 0, ClientFirstName VARCHAR(30) NOT NULL DEFAULT "first name", ClientLastName VARCHAR(30) NOT NULL
Create Table Mysql
DEFAULT "last name", ClientPhone CHAR(10) NOT NULL, ClientEmail TINYTEXT(30) NULL, ClientAddress TINYTEXT(128) NOT NULL, PRIMARYKEY(ClientID) ); CREATE TABLE branchtable( BranchID SMALLINT(15) NOT NULL DEFAULT 0, BranchCity TINYTEXT(30) NOT NULL DEFAULT city, BranchManagerFName VARCHAR(30) NULL DEFAULT "Branch Manager's First Name", BranchManagerLName VARCHAR(30) NULL DEFAULT "Branch Manager's LAst Name", BranchPhone CHAR(10) NOT NULL, BranchEmail TINYTEXT(30) NULL DEFAULT @bank.com, PRIMARYKEY(BranchID) ); CREATE TABLE transactiontable( TypeID SMALLINT(15) NOT NULL DEFAULT 0, Type ENUM('CHEQUING','SAVINGS') NOT NULL, TransAmount DECIMAL NOT NULL, TransDate TIMESTAMP NOT NULL, Balance DOUBLE NOT NULL, PRIMARYKEY(TypeID) ); Running this code in MySQL on the command line gives me 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 '(TypeID) )' at line 7 I've tried creating different test tables, leaving out the NULL/NOT NULL, but nothing seems to work. Any help would be very, very appreciated! mysql command-line mysql-error-1064 create-table share|improve this question edited Jun 27 '12 at 16:13 Ricardo Altamirano 5,073124989 asked Jun 27 '1
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the mysql create table example workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn 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. http://stackoverflow.com/questions/11218713/syntax-error-1064-in-create-table-statement-with-tinytext-columns 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 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to http://stackoverflow.com/questions/28067915/mysql-error-1064-creating-table 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 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 specializati
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 http://dba.stackexchange.com/questions/34076/creating-table-syntax-error-1064 Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site https://www.daniweb.com/programming/databases/threads/287185/create-table-error-1064 for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question error 1064 Anybody can answer The best answers are voted up and rise to the top creating table syntax error 1064 up vote 2 down vote favorite I'm using workbench to create a table. This script is giving me a problem. It is saying that there is a syntax error new '). DROP TABLE IF EXISTS `waitronmain`.`managers` ; CREATE TABLE IF NOT EXISTS `waitronmain`.`managers` ( `manager_id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) mysql error 1064 NOT NULL , `email` VARCHAR(45) NOT NULL , `password` VARCHAR(45) NOT NULL , `restaurant` VARCHAR(45) NOT NULL , `location` VARCHAR(45) NULL , PRIMARY KEY (`manager_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `waitronmain`.`waiters` -- ----------------------------------------------------- DROP TABLE IF EXISTS `waitronmain`.`waiters` ; CREATE TABLE IF NOT EXISTS `waitronmain`.`waiters` ( `waiter_id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `password` VARCHAR(45) NOT NULL , PRIMARY KEY (`waiter_id`) , INDEX `manager_id` () , CONSTRAINT `manager_id` FOREIGN KEY () REFERENCES `waitronmain`.`managers` () ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; The line causing the problem is this: INDEX `manager_id` () , Any ideas? I'm at a loss, the code was generated from an ERD model I made within Workbench so I'm suprised it has a syntax error at all. I got this error code when executing: Error Code: 1064 You have an error in your SQL syntax mysql mysql-workbench share|improve this question edited Feb 4 '13 at 17:15 bluefeet♦ 6,06522255 asked Feb 4 '13 at 16:18 Javacadabra 12827 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote I see a few issues with your existing code to create the waiters table. First, the index creation code is incorrect. The column to be in
don't see anything wrong here. Very basic but it is giving me a headache. Any suggestions are welcome. I am running version 5.1.37 and the error is: Error Code : 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 ''visit_recipes' ('id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 'name' text NO' at line 1 (0 ms taken) CREATE TABLE 'visit_recipes' ('id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 'name' text NOT NULL, 'ingredients' text NOT NULL, 'instructions' text NOT NULL, 'created_by' INTEGER NOT NULL, 'userip' VARCHAR(16), 'date_added' text NOT NULL, PRIMARY KEY('id')); mysql ProfessorPC 19 279 posts since Dec 2007 Community Member 2Contributors 1Reply 3Views 6 YearsDiscussion Span 6 Years Ago Last Post by griswolf 0 griswolf 304 6 Years Ago You appear to be translating from (postgresql?) where type text is the best option. In MySQL, varchar(size) is a better choice if possible. However, it does work, so I have not changed it. The syntax issue is the single quotes. If you want to quote table or column names, you need to use back-quote (`) not a normal quote ('). I've just removed your wrong quotes. This works for me: CREATE TABLE visit_recipes ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name text NOT NULL, ingredients text NOT NULL, instructions text NOT NULL, created_by INTEGER NOT NULL, userip VARCHAR(16), date_added text NOT NULL ); This question has already been answered. Start a new discussion instead. Message Insert Code Snippet Alt+I Code Inline Code Link H1 H2 Preview Submit your Reply Alt+S Ask a Different Databases Question Related Articles ERROR 1005 (HY000): Can't create table 'jfunchio.movie_actor' (errno: 150) 1 reply Can anyone help me figure out why the table movie_actor cannot be created and how to fix it? I know it's the only table without … error ERROR 1005 (HY000): Can't create table 'jfunchio.rental' (errno: 1