create table meteodb(ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,MDATE DATETIME NOT NULL UNIQUE,TEMPERATURE VARCHAR(20),PRESSURE VARCHAR(20),WIND_DIRECTION VARCHAR(20),WIND_COUNT VARCHAR(20),HUMIDITY VARCHAR(20),RAIN_COUNT VARCHAR(20),FAST_DEWPOINT VARCHAR(20),DEWPOINT VARCHAR(20));

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,AVG(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Mo_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Month;

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,AVG(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Mo_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Mo_temp; 

 SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,AVG(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Mo_temp,MAX(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Max_temp,MIN(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Min_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Month; 

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,AVG(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Mo_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 AND (CAST(TEMPERATURE AS DECIMAL(5,2))>35 OR CAST(TEMPERATURE AS DECIMAL(5,2))<0) GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))ORDER BY Month;

SELECT COUNT(DISTINCT CAST(TEMPERATURE AS DECIMAL(5,2))) AS Distinct_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017; 

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,AVG(CAST(TEMPERATURE AS DECIMAL(5,2))) AS Mo_temp FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 AND CAST(HUMIDITY AS UNSIGNED INT)<50 AND CAST(WIND_COUNT AS DECIMAL(5,2))>20 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Month; 

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,MAX(CAST(RAIN_COUNT AS DECIMAL(5,2))) AS Max_rain FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 AND CAST(RAIN_COUNT AS DECIMAL(5,2))>0 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Max_rain;  
 
SELECT COUNT(DISTINCT WIND_DIRECTION) AS Distinct_wind FROM meteodb;

SELECT MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))AS Month,COUNT(*) AS Greaterthan25 FROM meteodb WHERE YEAR(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s'))=2017 AND CAST(TEMPERATURE AS DECIMAL(5,2))<25 GROUP BY MONTH(STR_TO_DATE(MDATE,'%Y-%m-%d %H:%i:%s')) ORDER BY Month; 

SELECT DISTINCT CAST(HUMIDITY AS UNSIGNED INT) AS Wrong_numbers FROM meteodb WHERE CAST(HUMIDITY AS UNSIGNED INT)>99 OR CAST(HUMIDITY AS UNSIGNED INT)<0; 