mysql solution for all leetcode database questions
select w1.id from Weather w1, Weather w2
where datediff(w1.recordDate, w2.recordDate) = 1 and w1.temperature > w2.temperature
select w.name, w.population, w.area from World w
where w.area>3000000 or w.population>25000000
select c.class from (SELECT DISTINCT * FROM courses) AS c
group by c.class
having count(*) >= 5;
Notice that there is no space between count and (), always be like count()
select id, movie, description, rating from cinema
where (id % 2 != 0) and description != 'boring'
order by rating desc
update salary
SET sex = case when sex='m' then 'f' else 'm' end
Notice that update is followed by the table name and case when else end is the content that sex equals to.