What does this piece of sql statement mean?

4

I have this statement in the database modeling file and would like to know what it is about.

'price_type' enum("S" "M")
    
asked by anonymous 27.06.2016 / 12:38

1 answer

8

This is a enum .

With an enum you can restrict the values of a column to the specified options, eg in your case 'S' or 'M' . Enum is a fairly efficient and compact type. Internally the bank uses numbers to represent each value of enum . Generally we use enum when the values of a column belong to a well defined and static universe (ie, you do not predict new types of price, if this were the case a foreign key for a domain table with the types of price would be a better solution ).

    
27.06.2016 / 13:02