Join Sheeri Cabral for an in-depth discussion in this video Creating and using virtual columns, part of Advanced MySQL and MariaDB.
Virtual columns are columns in a table that are computed…usually based on other values in the table.…They were introduced in MariaDB version five point two…and do not yet exist in MySQL.…Virtual tables have some great applications.…One common suggestion for optimizing email addresses…is to store the address and the reverse of the email address…so that you can index both fields…and easily count how many people are in a certain domain.…Another common issue, is that developers often store…Unix time stamps and when a DVA is trying to debug an issue…they have to use the from Unix time function.…
Both these cases can be resolved using virtual columns.…If you do not already have a database for testing,…create one and use it.…So, let's CREATE DATABASE IF NOT EXISTS examples…and then USE examples.…Let's clear our screen with control L.…Now, let's make a table with virtual columns.…We start out our CREATE TABLE as usual,…and let's just call this table virt_cols.…We could call it anything we want.…
First, let's put in our regular columns.…
Want more information about MariaDB? Check out Understanding MariaDB for MySQL Users.
- Comparing MariaDB and MySQL
- Creating and using virtual columns in MariaDB
- Building Sphinx tables
- Installing HandlerSocket
- Setting up GTIDs in MariaDB and MySQL
- Audit logging in MariaDB and MySQL
- Using GIS in MariaDB and MySQL