Hi Sören,

Hi all,

MySQL has the neat feature of defining a table column to be a
enumeration or set of a number of elements, e.g.:

create table person (
 name varchar,
 sex enum('male', 'female')
)

or:

create table person (
 name varchar,
 likes_fruits set('apple', 'pear','orange')
)

I guess something like this can be emulated using user defined types.
However, from reading the documentation I could not figure out how.
Can anybody help me?

You can add check constraint either in the create table statement, or add it afterwards.

i.e. for ex.:

create table person (
name varchar,
likes_fruits varchar CHECK ( likes_fruits in ('apple', 'pear','orange'))
);


Examples you can find here in the Virtuoso doc:

http://docs.openlinksw.com/virtuoso/CREATETABLE.html#sqlrefcreattablecheck
http://docs.openlinksw.com/virtuoso/ALTERTABLE.html#sqlrefalttabcheck

Best Regards,
Rumi


Soren

PS: Is the bug tracker and feature request database at sourceforge
actually in use? If I use it, will somebody have a look at the stuff
there every now and then?



Reply via email to