Re: inserting into sets

2002-02-16 Thread Paul DuBois

At 22:47 -0500 2/16/02, John Fulton wrote:
>Would someone please tell me how to insert sets into a MySQL DB? 
>e.g. insert into table_name (x) values ("'a', 'b', 'c', 'd'"); ,
>where x is a set.  I am unsure on what should be inside of the second
>set of parentheses.

A SET value is a single string constructed from individual SET members
separated by commas.

INSERT INTO table_name (x) VALUES('a,b,c,d');


>
>Sorry to be posting a syntax question to the list, but I don't see it
>spelled out in the manual, or at least I am unable to figure it out if
>it is there, and I thought that it would be easy to answer for one of
>you.  I have wasted lots of time searching the web for the syntax, as
>well as experimenting, with no results. 
>
>Thanks,
>   John 
>
>PS:  Here is what I am trying to do in more detail if it helps. 
>
>mysql> describe applicant_ext_skills;
>+---++--+-+-+---+
>| Field | Type
>| Null | Key | Default | Extra |
>+---++--+-+-+---+
>| applicant_num |
>int(5) 
>|
>| PRI | 0   |   |
>| unix_arr  |
>set('rlogin','ls','cd','more','kill','cp','mv','rm','mkdir','pwd','rmdir','chmod','quota','du','lprm','man','ftp','grep','ps','lpq','lpr','pipe','redirect','mpage','newuser')
> 
>|
>YES  | | NULL|   |
>+---++--+-+-+---+
>
>mysql> insert into applicant_ext_skills (applicant_num, unix_arr) values
>(3, "'rlogin', 'ls', 'cd', 'more', 'kill', 'cp', 'mv', 'rm', 'mkdir'");
>Query OK, 1 row affected (0.00 sec)
>
>mysql>
>
>Where the collection of unix commands is the set I am trying to insert. 
>However, nothing seems to be getting stored. 
>
>mysql> select applicant_num from applicant_ext_skills;
>+---+
>| applicant_num |
>+---+
>| 0 |
>| 1 |
>| 2 |
>| 3 |
>+---+
>4 rows in set (0.00 sec)
>
>mysql> select unix_arr from applicant_ext_skills;
>+--+
>| unix_arr |
>+--+
>| NULL |
>|  |
>|  |
>|  |
>+--+
>4 rows in set (0.00 sec)
>
>mysql>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




inserting into sets

2002-02-16 Thread John Fulton


Would someone please tell me how to insert sets into a MySQL DB?  
e.g. insert into table_name (x) values ("'a', 'b', 'c', 'd'"); , 
where x is a set.  I am unsure on what should be inside of the second
set of parentheses.  

Sorry to be posting a syntax question to the list, but I don't see it
spelled out in the manual, or at least I am unable to figure it out if 
it is there, and I thought that it would be easy to answer for one of 
you.  I have wasted lots of time searching the web for the syntax, as 
well as experimenting, with no results.  

Thanks, 
  John  

PS:  Here is what I am trying to do in more detail if it helps.  

mysql> describe applicant_ext_skills;
+---++--+-+-+---+
| Field | Type
| Null | Key | Default | Extra |
+---++--+-+-+---+
| applicant_num |
int(5) 
   
 |
| PRI | 0   |   |
| unix_arr  |
set('rlogin','ls','cd','more','kill','cp','mv','rm','mkdir','pwd','rmdir','chmod','quota','du','lprm','man','ftp','grep','ps','lpq','lpr','pipe','redirect','mpage','newuser')
 |
YES  | | NULL|   |
+---++--+-+-+---+

mysql> insert into applicant_ext_skills (applicant_num, unix_arr) values
(3, "'rlogin', 'ls', 'cd', 'more', 'kill', 'cp', 'mv', 'rm', 'mkdir'");
Query OK, 1 row affected (0.00 sec)

mysql> 

Where the collection of unix commands is the set I am trying to insert.  
However, nothing seems to be getting stored.  

mysql> select applicant_num from applicant_ext_skills;
+---+
| applicant_num |
+---+
| 0 |
| 1 |
| 2 |
| 3 |
+---+
4 rows in set (0.00 sec)

mysql> select unix_arr from applicant_ext_skills;
+--+
| unix_arr |
+--+
| NULL |
|  |
|  |
|  |
+--+
4 rows in set (0.00 sec)

mysql> 






-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php