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,...