Join Sheeri Cabral for an in-depth discussion in this video Nested dynamic columns, part of Understanding MariaDB for MySQL Users.
- View Offline
…MariaDB allows you to nest dynamic columns.…That means that one of the parts of a dynamic column can itself be…a dynamic column.…In our items table, we have CDs and DVDs, both of which have subparts.…A CD has songs and a DVD has chapters.…What if we want to represent chapters and songs as dynamic…columns within the dynamic column of extra that we already have?…MariaDB allows you to do this.…
Remember that you use COLUMN_ADD to add a new part to an existing dynamic column and…COLUMN_CREATE to create a new dynamic column type.…Before we add chapters to our DVD,…let's do a quick refresh of the extra dynamic column for our DVD.…So let's SELECT COLUMN_JSON of extra FROM items WHERE type equals DVD.…We have one dynamic column part called in stock, with a value of 10.…So, to add chapters to our DVD, we could write a query like this.…
UPDATE items SET extra equal to, and here we're going to use COLUMN_ADD so…that we preserve the existing dynamic column part while we add a new part.…So we're adding the new part to extra and…
- Why use dynamic columns?
- Creating, updating, and querying dynamic columns
- Installing the CONNECT storage engine
- Connecting to remote data
- Connecting to CSV, INI, and XML files
- Using PIVOT tables
- Accessing database metadata
- Working with the Cassandra storage engine