I wrote the following query for a project of mine, it is working perfect, however it is working only for mysql 8 since I am using \'over\' function in the query which is not