Skip to content

Tag: mysql

MySql using interval with a list of dates

I’m willing to fetch all the dates that are listed in the list reducing 1 day I’m trying something like that: I wish to receive: ‘2022-03-21’, ‘2022-03-17’, ‘2022-03-10’ Answer It can be done with intervals. Here is a link to how it works : https://www.db-fiddle…

SQL CASE WHEN won’t meet condition

This is a solution to one of the leetcode problem. It is asking me to output the second highest salary from the table and if there are no second highest salary then the output should be null. The above is my solution. I used case and when syntax but the problem is that even when the table only has 1

Need guidance on MySQL Query

I am having a table with values like this below one. Col1 Col2 Col3 Col4 col5 1 John ABC 10 20 1 John AED 52 15 1 John ABC 12 10 1 John AED 20 5 1 John ABC 10 5 2 Mark DDD 42 8 2 Mark BBB 10 5 3 Ben EEE 8 2 3 Ben FFF 1