Jump to content

Creating a database and table. Errors


Laurent*

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 comment
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 comment
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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...