1.

Creating a table with query

Answer»

>CREATE TABLE myset (col SET('a', 'B', 'c', 'd'));

And INSERTING the values 

>INSERT INTO myset (col) VALUES  ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');

what will be the output of this query?

>SELECT col FROM myset; | col  | +------+ | a,d  | | a,d  | | a,d  | | a,d  | | a,d  |

For a value containing more than one SET element, it does not matter what ORDER the elements are listed in when you insert the value. It also does not matter how MANY times a given element is listed in the value. When the value is retrieved later, each element in the value appears once, with elements listed according to the order in which they were specified at table CREATION time.



Discussion

No Comment Found