
MariaDb Essentials
By :

The PIVOT table type allows you to do exactly the reverse operation of the OCCUR table. Let's start by creating a copy of our data in a new table.
CREATE TABLE xvisitors2 ( year char(4) NOT NULL, month char(3) NOT NULL, number int(10) NOT NULL ) ENGINE=CONNECT; INSERT INTO xvisitors2 SELECT * FROM xvisitors;
Now we can create a new PIVOT table:
CREATE TABLE pvisitors ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=xvisitors2;
You should now be used to the TABLE_TYPE
and TABNAME
options, which specify the table type and the source table respectively.
If you have issues when creating this table, and get an Access denied
error, please consult the documentation about proxy on non-CONNECT tables at https://mariadb.com/kb/en/mariadb/connect-table-types-proxy-table-type/.
You can now run the following query to check if the PIVOT operation has been realized:
SELECT * FROM pvisitors;
Since we didn't specify any option when creating the table, MariaDB considered the last...
Change the font size
Change margin width
Change background colour