I have two columns in table, column1 INT(11) and column2 DATE_TIMESTAMP. I want to extract only date from column2 and use it along with column1 as unique key so that any new insert or update operation with the same column1 and column2 will raise a constraint error.
For example, if my table has a row with column1 = 111 and date=10/10/2022 then a new insert with the same values will throw constraint but column1 = 111 and date=11/10/2022 or column1 = 222 and date=10/10/2022 will be executed successfully.
NOTE: I have a unique auto_incremnet id as a primary key.