List:General Discussion« Previous MessageNext Message »
From:Claudia M. Castaneda Date:July 22 1999 3:43pm
Subject:Something about sets...
View as plain text  
that I do not understand.

I created a table:

mysql> CREATE TABLE keywords_set (
    ->   id int AUTO_INCREMENT NOT NULL,
    ->   keywords set ('Flood Zones','Wetlands','Hydrology','Buildings'),
    ->   PRIMARY KEY (id)
    -> );
Query OK, 0 rows affected (0.06 sec)

Then inserted some data:
mysql> insert into keywords_set values ('Wetlands','Hydrology');
Query OK, 1 row affected (0.00 sec)

mysql>insert into keywords_set values ('Flood Zones','Buildings');
mysql>insert into keywords_set values ('Wetlands', 'Flood Zones');

mysql>insert into keywords_set values ('Wetlands');
ERROR 1136: Column count doesn't match value count at row 1

mysql>insert into keywords_set values ('Hydrology','Buildings','Flood
Zones');
ERROR 1136: Column count doesn't match value count at row 1

What does column count has to do with the number of elements in a set?
Am I interpreting that error message correctly?

And now, selecting data:
mysql> select id, keywords from keywords_set;
+----+-------------+
| id | keywords    |
+----+-------------+
|  1 | Hydrology   |
|  2 | Buildings   |
|  3 | Flood Zones |
+----+-------------+
3 rows in set (0.00 sec)

mysql>select id from keywords_set where keywords like 'Wetlands';
Empty set (0.00 sec)
mysql> select id from keywords_set where keywords like '%Wetlands%';
Empty set (0.00 sec)
mysql> select id from keywords_set where 
FIND_IN_SET('Wetlands',keywords)>0;
Empty set (0.01 sec)

mysql> select id from keywords_set where
FIND_IN_SET('Hydrology',keywords)>0;
+----+
| id |
+----+
|  1 |
+----+
1 row in set (0.00 sec)

Could you see what is what I am doing wrong? Why cannot I insert just one
element from the set? Why cannot I retrieve the word 'Wetlands' from the
set?
Thank you,
---
Claudia M. Castaneda
KT-Tech, Incorporated
9801 Greenbelt Rd. Suite 314
Lanham MD 20706  USA
301 552 2411 Fax 301 552 2638


Thread
Something about sets...Claudia M. Castaneda22 Jul
  • Something about sets...sinisa22 Jul
    • Re: Something about sets...Nem W Schlecht22 Jul
RE: Something about sets...Darren L Sweeney22 Jul
  • RE: Something about sets...Dan Ray22 Jul