0

Hello,

I am brushing-up on SQL (using MySQL). It has been many years since I have worked with this and I'm having some trouble getting started.

I have looked at a tutorial and entered the code below:

CREATE TABLE employees (              
             employeeNumber into(11) NOT NULL,    
             lastName varchar(50) NOT NULL,      
             firstName varchar(50) NOT NULL,     
             extension varchar(10) NOT NULL,     
             email varchar(100) NOT NULL,        
             officeCode varchar(10) NOT NULL,    
             reportsTo int(11) default NULL,     
             jobTitle varchar(50) NOT NULL,      
             PRIMARY KEY  (employeeNumber)       
           );

I receive the error message in return:

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 
'juggernaut
CREATE TABLE employees (
             employeeNumber in' at line 1

I am not quite sure what the message is referring to - I assumed it should run just fine.
If I remove the "employeeNumber into(11) NOT NULL," line completely the same error message returns for the next line.

I'm puzzled. :confused:

Thank-you in advance for any guidance in the right direction.

-Matty

4
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by mattyd
0

Hi

>>> if I remove the "employeeNumber into(11) NOT NULL," line completely the same error message returns for the next line.


Be that as it may, "into(11)" isn't a datatype --> int(11) seems to be correct.

-- tesu

0

Hi

>>> if I remove the "employeeNumber into(11) NOT NULL," line completely the same error message returns for the next line.


Be that as it may, "into(11)" isn't a datatype --> int(11) seems to be correct.

-- tesu

I make changes per your suggestion. Please see attached image of results. Thanks.

Attachments s1.jpg 138.98 KB
0

Worked fine for me in the MySQL monitor in terminal.

mysql> CREATE TABLE employees (              
    ->              employeeNumber int(11) NOT NULL,    
    ->              lastName varchar(50) NOT NULL,      
    ->              firstName varchar(50) NOT NULL,     
    ->              extension varchar(10) NOT NULL,     
    ->              email varchar(100) NOT NULL,        
    ->              officeCode varchar(10) NOT NULL,    
    ->              reportsTo int(11) default NULL,     
    ->              jobTitle varchar(50) NOT NULL,      
    ->              PRIMARY KEY  (employeeNumber)       
    ->            );
Query OK, 0 rows affected (0.10 sec)
0

Worked fine for me in the MySQL monitor in terminal.

mysql> CREATE TABLE employees (              
    ->              employeeNumber int(11) NOT NULL,    
    ->              lastName varchar(50) NOT NULL,      
    ->              firstName varchar(50) NOT NULL,     
    ->              extension varchar(10) NOT NULL,     
    ->              email varchar(100) NOT NULL,        
    ->              officeCode varchar(10) NOT NULL,    
    ->              reportsTo int(11) default NULL,     
    ->              jobTitle varchar(50) NOT NULL,      
    ->              PRIMARY KEY  (employeeNumber)       
    ->            );
Query OK, 0 rows affected (0.10 sec)

Thank-you for your reply. :) It's odd, I do this in the MySQl Terminal and keep getting the same error.

0

I'm new to MySQL, so pardon the dumb question, but what does the word 'juggernaut' mean when it appears immediately before your CREATE statement (as shown in your attached thumbnail)?

0

I'm new to MySQL, so pardon the dumb question, but what does the word 'juggernaut' mean when it appears immediately before your CREATE statement (as shown in your attached thumbnail)?

"juggernaut" is the name of my database.

0

should be

use juggernaught;

Thank-you for pointing this out. :icon_wink:

-Matty

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.