Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field constraints within tables

Status
Not open for further replies.

rbeech23

Programmer
Dec 22, 2002
14
GB
I've a create statement with a field which reads
creat table field1,field2 etc,`Gender` enum('Male','Female') NOT NULL default 'Male'

The problem I have with the Gender field is I can update values and set Gender to '' which I dont want, I thought the enum option would prevent anything other than Male or Female being inserted as a value.

Any help appreciated

Thanks
 
Yes, that would be my opinion as well. As far as I can see there is no way round this.

You can get the rows where gender contains '' by using the query

Code:
select * from t where gender = 0

In general, Mysql stinks with regard to data integrity.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top