Jump to content

Creating a database and table. Errors


Recommended Posts

Hey, I need to create a database and tables. I'm using phpmyadmin to do this. According to the professor's Power point slides the code below should create a table however it got me an error. I don't know how to think about this yet so go easy on me please.  

 

 

CiNesnA.png

CREATE TABLE zodiacsigns (Sign VARIABLES(10), President VARIABLES(75));

 

Quote

 

Error

Static analysis:

2 errors were found during analysis.

 

  1. Unrecognized data type. (near "VARIABLES" at position 31)
  2. Unrecognized data type. (near "VARIABLES" at position 56)

 

SQL query:

CREATE TABLE zodiacsigns (Sign VARIABLES(10), President VARIABLES(75))

MySQL said: Documentation

#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 'VARIABLES(10), President VARIABLES(75))' at line 1

 

 

Link to post
Share on other sites

The code you presented is trying to create a table with two fields, each of type "VARIABLES," but "VARIABLES" is not a valid data type. My guess is that whoever wrote the query intended to write VARCHAR.

  • Like 1
Link to post
Share on other sites

I failed this assignment but I thrived in the next one which was worth more. Anyways the professors code examples aren't good and I decided to stop using the resources. This is why I struggled because I thought I needed to use his examples and I had a different SQL with different syntax.

I was trying to create a data base named chinese_zodiac. This thread is done. 

Edited by Laurent*
Link to post
Share on other sites

The error was because you were trying to tell it to use a data type that does not exist, so I linked you to the list of data types.  Hopefully you know what general data type you were trying to store, if it was text or numbers or whatever, and could find an appropriate one in the list.  If you don't know what kind of data you're trying to store, the first step is to figure that out.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...