The problem of using the sum function for the MySQL enum type

Updated on technology 2024-02-26
6 answers
  1. Anonymous users2024-02-06

    After MySQL is installed, there is a MySQL database configuration wizard, open the next step one by one, go to the encoding selection, select the "Japanese" option, that is, let MySQL use UTF-8 encoding by default. Try it.

  2. Anonymous users2024-02-05

    Starting with MySQL, when a table is created, the space at the end of the enum value is automatically removed.

    When assigning a value to an enum column, the case of the letters is irrelevant. However, the case of the values retrieved from the column later matches the allowed values specified when the table was created.

    If an enum is retrieved in a numeric context, the index value of the column value will be returned. For example, you can retrieve an enum column with a numeric value like this:

    mysql> select enum_col+0 from tbl_name;

    If a number is stored in an enum, the number is treated as an index value, and the stored value is the enumeration member corresponding to the index value. (However, this won't work in load data, because it treats all inputs as strings.) It's not wise to store numbers in an enum string, as it can disrupt the mind.

    The enum values are sorted according to the list order in the column specifications. (In other words, enum values are sorted by their index number.) For example, for enum("a", "b") "a"Ranked in"b", but for enum("b", "a") ,"b"But in line"a"Before.

    Empty strings precede non-null strings, and null values precede all other enumerated values. To prevent unexpected results, it is recommended to define the enum list in alphabetical order. You can also use Group by Concat(Col) to determine which sort alphabetically rather than by indexing values.

    If you want to get all the possible values for an enum column, you can use show columns from table name like enum colum

  3. Anonymous users2024-02-04

    Hello, the usual practice is that the database is not limited, but at the UI layer or the data layer.

  4. Anonymous users2024-02-03

    ENUM is a type of data in computer programming languages. Enumeration type: In practice, the value of some variables is limited to a limited range.

    For example, there are only seven days in a week, there are only twelve months in a year, a class has six courses per week, and so on. If these quantities are described as integers, it is obviously inappropriate for characters or other types to be used. For this purpose, the C language provides a type called "enumeration".

    In the definition of the "enumeration" type, all possible values are listed, and the values of the variables of the "enumeration" type cannot exceed the defined range. It should be noted that an enumeration type is a primitive data type, not a constructor type, as it can no longer be decomposed into any primitive type.

    The enumeration type is specified in the following usage:

    1.Enumerated values are constants, not variables. You can't assign a value to it in a program with an assignment statement.

    2.The enumeration element itself is defined by the system as a numerical value representing the ordinal number, starting with 0, in order of 0, 1, 2.... For example, in Weekday, the sun value is 0, the mon value is 1, and the sat value is 6.

    You can only assign enumerated values to enumerated variables, not the numerated values of elements directly to enumerated variables. If you must assign a numeric value to an enumerated variable, you must use a cast conversion.

  5. Anonymous users2024-02-02

    The main advantage is that some values can be standardized when building a database. The downside is. ENUM is not suitable for PHP.

    The main thing is that php is weakly typed, such as: you insert into .set a= 1, you can't tell if you want a='1'Or a= 1 (a='1'is to insert the value 1, a=1 is the first value to insert enum, especially php weak type, if int, few people put double quotes in sql. This is the biggest problem with PHP and MySQL when using ENUM. So.. Rest assured.

    Just order tinyin directly

  6. Anonymous users2024-02-01

    The storage of many variables follows a principle, which can be saved without the database, because connecting to the database, managing the database, and closing the database resources consume memory, which affects the operation of the entire program, and it is generally recommended to save the variables in the cache.

Related questions
8 answers2024-02-26

Sweat. I'll use an emulator to give you one.,This is my own addition.,Some skills may be missed if you don't play the game.。 Add points below. >>>More

4 answers2024-02-26

Personality types are:

1. Lively personality: very emotional to people, straightforward speech. I like to say it before I do it, regardless of whether I can cash in on it or not. Lively people do things and focus on interpersonal relationships. >>>More

3 answers2024-02-26

microsoft jet database engine (0x80004005)

The operation must use the Update query. >>>More

2 answers2024-02-26

The types of curly hair are:

Spiral perm, horn perm, diamond perm, ceramic perm, root perm, fiber perm, trumpet perm, air perm, braid perm, corn whisker perm. >>>More

4 answers2024-02-26

Paper is often seen in daily life, although it is a very commonly used paper, but there are many types of it, the first is letterpress printing paper, this quantitative is about 50 to 80 grams per square, usually used to print books. Then there is newsprint, which is called white newspaper, and the amount is about 51 grams, which is mainly used in newspapers or periodicals. Jiaozhen shouts board printing paper, the quantity is about 60 to 180 grams, coated paper, this quantitative is about 90 to 250 grams, this kind of can not be folded, it is very troublesome to restore after a slight crease. >>>More