Book Image

MariaDb Essentials

By : Kenler
Book Image

MariaDb Essentials

By: Kenler

Overview of this book

This book will take you through all the nitty-gritty parts of MariaDB, right from the creation of your database all the way to using MariaDB’s advanced features. At the very beginning, we show you the basics, that is, how to install MariaDB. Then, we walk you through the databases and tables of MariaDB, and introduce SQL in MariaDB. You will learn about all the features that have been added in MariaDB but are absent in MySQL. Moving on, you’ll learn to import and export data, views, virtual columns, and dynamic columns in MariaDB. Then, you’ll get to grips with full-text searches and queries in MariaDb. You’ll also be familiarized with the CONNECT storage engine. At the end of the book, you’ll be introduced to the community of MariaDB.
Table of Contents (10 chapters)
9
Index

Using the OCCUR table type


The OCCUR table type allows you to create a new view of a table. A new row will be created for each cell of the table, the row will contain the name of the row, the name of the column, and the value in the corresponding cell.

We will first create a standard table with some data for practice:

CREATE TABLE `visitors` (
  `year` char(4) NOT NULL,
  `Jan` int(10) NOT NULL DEFAULT '0',
  `Feb` int(10) NOT NULL DEFAULT '0',
  `Mar` int(10) NOT NULL DEFAULT '0',
  `Apr` int(10) NOT NULL DEFAULT '0',
  `May` int(10) NOT NULL DEFAULT '0',
  `Jun` int(10) NOT NULL DEFAULT '0',
  `Jul` int(10) NOT NULL DEFAULT '0',
  `Aug` int(10) NOT NULL DEFAULT '0',
  `Sep` int(10) NOT NULL DEFAULT '0',
  `Oct` int(10) NOT NULL DEFAULT '0',
  `Nov` int(10) NOT NULL DEFAULT '0',
  `Dec` int(10) NOT NULL DEFAULT '0'
) ENGINE=CONNECT;
INSERT INTO visitors VALUES
('2015', 121, 172, 199, 181, 108, 199, 171, 156, 170, 183, 105, 176),
('2014', 167, 108, 137, 161, 198, 104, 129, 132, 172, 167,...