I have a table which is updated hourly. It stores of the data of Air Quality Index of different cities. The structure is like this:
id | city_code | date_time | pollution_level
-- --------- --------- ---------------
1 100 2017-02-06 13:00:00 349
2 150 2017-02-06 13:00:00 245
3 100 2017-02-06 14:00:00 325
4 150 2017-02-06 14:00:00 216
Now the problem is, I want to add a unique key in such a way that it should store data of particular city only once in same hour. Pollution level of city 100 at 2017-02-06 13:00:00 should not be there more than once in the table. Is there any way I can do it within database or any other good solution with PHP.