Thanks for reply and sorry for lack of information.

What I want to know is not how to query,
but how to prevent emtpy data from being inserted in tables.

Let's say I'd like to have a table that doesn't contains any NULL value.
I'd create the table like below.

##################################
mysql> create table t (a char(10) not null);
create table t (a char(10) not null);
Query OK, 0 rows affected (0.07 sec)

mysql> insert into t values(NULL);
insert into t values(NULL);
ERROR 1048 (23000): Column 'a' cannot be null
##################################

well, looks good,
but NOT NULL only prevent NULL, as the name implied.


##################################
mysql> insert into t values('');
Query OK, 1 row affected (0.00 sec)

mysql> select * from t;
select * from t;
+---+
| a |
+---+
|   |
+---+
1 row in set (0.01 sec)
###################################

Is there any easy way to implement 'NOT EMPTY' constraint?

Thank you in advance.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to