Forum Moderators: coopster

Message Too Old, No Replies

Define a specific integer range for a mysql field

         

Adam_C

9:59 pm on Feb 16, 2004 (gmt 0)

10+ Year Member



Am having a play around with PHP and mysql - which I must admit are a little new to me.

I want to create a field in the mysql database for integer values between 0 and 5.

Much appreciated if someone could spoonfeed me the command.

Cheers

coopster

11:04 pm on Feb 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The MySQL manual has a fairly decent tutorial [mysql.com] to get you going with the database.

If you just wanted a single column in your table it would look something like this:

CREATE TABLE [mysql.com] mytable (mynumber SMALLINT); 

You'll want to learn about column types [mysql.com] as well. That way you'll know how to define your columns when you are creating your tables. You may also want to get comfortable with SQL standards. MySQL is pretty good about letting you know when they have created an extension to the standard. The MySQL manual is an invaluable resource. You'll want to get comfortable with it, Adam_C :)