Comments - Generated (Virtual and Persistent/Stored) Columns

8 years, 7 months ago Jan Steinman

Let's try some <code>:

ALTER TABLE `z_test`
    ADD `Last_name_bit_length` INT(5)
        AS (BIT_LENGTH(`Name_Last`)) PERSISTENT
        AFTER `Name_Last`;

MariaDB [EcoReality]> SELECT Name_Last, Last_name_bit_length from z_test;
+------------+----------------------+
| Name_Last  | Last_name_bit_length |
+------------+----------------------+
| Bartfast   |                   64 |
| Flintstone |                   80 |
| Huston     |                   48 |
| Bah        |                   24 |
+------------+----------------------+
4 rows in set (0.00 sec)

Ah, that's better. :-)

 
8 years, 7 months ago Jan Steinman

(You guys REALLY need an "Edit" button...)

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.