I would suggest:
1) There is no Boolean-Type in mySQL, but when you define a table, use BOOL as a synonyme for TINYINT(1):
create table
2) a value of 0 means false, any other integer apart from 0 means true. the value can also be null
If you assign values you will have to use the numbers: INSERT INTO tbl1 (name,ismember,retired) values ('john',0,-1);
3) The advantage of this method: you can use where clauses like this:
SELECT * FROM tbl WHERE ismember and not retired;
4) Another advantage: conversion from php boolean from and to mySQL boolean are simple
5) If you want to pack multiple boolean values into one byte or so to save storage you will have to do the packing and unpacking by yourself, otherwise mySQL uses 1 or 2 bytes (?) for each TINYINT field.
Please anyone correct me if i'm wrong.
Greetings
K.
ASHBeN wrote:
What's the equivalent data type for boolean (0/1, True/False) in mySQL?