-- SELECT title,
-- COUNT(IF(month(cin) = '01' AND year(cin) = '2010', 1, NULL)) '01-2010',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2010', 1, NULL)) '02-2010',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2010', 1, NULL)) '03-2010',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2010', 1, NULL)) '04-2010',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2010', 1, NULL)) '05-2010',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2010', 1, NULL)) '06-2010',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2010', 1, NULL)) '07-2010',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2010', 1, NULL)) '08-2010',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2010', 1, NULL)) '09-2010',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2010', 1, NULL)) '10-2010',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2010', 1, NULL)) '11-2010',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2010', 1, NULL)) '12-2010',

-- COUNT(IF(month(cin) = '01' AND year(cin) = '2011', 1, NULL)) '01-2011',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2011', 1, NULL)) '02-2011',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2011', 1, NULL)) '03-2011',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2011', 1, NULL)) '04-2011',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2011', 1, NULL)) '05-2011',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2011', 1, NULL)) '06-2011',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2011', 1, NULL)) '07-2011',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2011', 1, NULL)) '08-2011',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2011', 1, NULL)) '09-2011',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2011', 1, NULL)) '10-2011',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2011', 1, NULL)) '11-2011',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2011', 1, NULL)) '12-2011',

-- COUNT(IF(month(cin) = '01' AND year(cin) = '2012', 1, NULL)) '01-2012',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2012', 1, NULL)) '02-2012',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2012', 1, NULL)) '03-2012',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2012', 1, NULL)) '04-2012',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2012', 1, NULL)) '05-2012',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2012', 1, NULL)) '06-2012',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2012', 1, NULL)) '07-2012',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2012', 1, NULL)) '08-2012',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2012', 1, NULL)) '09-2012',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2012', 1, NULL)) '10-2012',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2012', 1, NULL)) '11-2012',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2012', 1, NULL)) '12-2012',

-- COUNT(IF(month(cin) = '01' AND year(cin) = '2013', 1, NULL)) '01-2013',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2013', 1, NULL)) '02-2013',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2013', 1, NULL)) '03-2013',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2013', 1, NULL)) '04-2013',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2013', 1, NULL)) '05-2013',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2013', 1, NULL)) '06-2013',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2013', 1, NULL)) '07-2013',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2013', 1, NULL)) '08-2013',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2013', 1, NULL)) '09-2013',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2013', 1, NULL)) '10-2013',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2013', 1, NULL)) '11-2013',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2013', 1, NULL)) '12-2013',

-- COUNT(IF(month(cin) = '01' AND year(cin) = '2014', 1, NULL)) '01-2014',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2014', 1, NULL)) '02-2014',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2014', 1, NULL)) '03-2014',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2014', 1, NULL)) '04-2014',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2014', 1, NULL)) '05-2014',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2014', 1, NULL)) '06-2014',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2014', 1, NULL)) '07-2014',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2014', 1, NULL)) '08-2014',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2014', 1, NULL)) '09-2014',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2014', 1, NULL)) '10-2014',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2014', 1, NULL)) '11-2014',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2014', 1, NULL)) '12-2014',

-- COUNT(IF(month(cin) = '01' AND year(cin) = '2015', 1, NULL)) '01-2015',
-- COUNT(IF(month(cin) = '02' AND year(cin) = '2015', 1, NULL)) '02-2015',
-- COUNT(IF(month(cin) = '03' AND year(cin) = '2015', 1, NULL)) '03-2015',
-- COUNT(IF(month(cin) = '04' AND year(cin) = '2015', 1, NULL)) '04-2015',
-- COUNT(IF(month(cin) = '05' AND year(cin) = '2015', 1, NULL)) '05-2015',
-- COUNT(IF(month(cin) = '06' AND year(cin) = '2015', 1, NULL)) '06-2015',
-- COUNT(IF(month(cin) = '07' AND year(cin) = '2015', 1, NULL)) '07-2015',
-- COUNT(IF(month(cin) = '08' AND year(cin) = '2015', 1, NULL)) '08-2015',
-- COUNT(IF(month(cin) = '09' AND year(cin) = '2015', 1, NULL)) '09-2015',
-- COUNT(IF(month(cin) = '10' AND year(cin) = '2015', 1, NULL)) '10-2015',
-- COUNT(IF(month(cin) = '11' AND year(cin) = '2015', 1, NULL)) '11-2015',
-- COUNT(IF(month(cin) = '12' AND year(cin) = '2015', 1, NULL)) '12-2015'

-- FROM spl_2016.inraw  
-- WHERE LOCATE( ('memory' AND 'embodied') OR ('memory' AND 'generation'), title) > 0
-- GROUP BY title;

SELECT title, year(cin), month(cin), count(cin)
FROM spl_2016.inraw 
WHERE (title like '%memory%' OR title like '%memories%') AND 
(title like '%embod%' OR title like '%generation%' or 
 title like '%body%' OR title like '%famil%' or 
 title like '%cognit%' OR title like '%autonom%')
GROUP BY title, year(cin), month(cin);
