Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MySql problem

Name: Anonymous 2010-07-22 6:10

Hi /prog/,

A MySQL noob needs some help here. I tried searching everywhere but it seems I cannot formulate my search expression correctly(English is not my first language). So the problem is. I want to limit the values that can be inserted in a column to certain possibilities. For example: I have a column phone_type and I want the only possible values there to be Work, Mobile, General and Fax. Any ideas? Sorry if this is too simple!

Name: Anonymous 2010-07-22 18:22

Easy way:
Put all your phone types in a single-column new table, create a primary key for it and add a foreign key constraint to the phone_type column.

Hard way:
Write a trigger function spitting an error if a user tries to put in a non-allowed value.

Hard way, God mode:
If a user tries again to insert the illegal value, do a DROP USER

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List