Top 10 Complex Sql Queries Interview Questions You Must Prepare 07.Jul.2022

SELECT * FROM Student order by id desc limit 1

SELECT std_id, COUNT(std_id) as cnt FROM Student GROUP by std_id having cnt > 1

SELECT * FROM Student where MOD(id,2) = 1

Based On the Below Student table We are Written All the Queries.

Student Table

SELECT marks FROM Student ORDER by marks DESC limit 1, 1;

SELECT * FROM Student where MOD(id,2) = 0

SELECT *  FROM Student order by std_id Desc limit 3

SELECT distinct(marks) FROM Student ORDER BY marks DESC LIMIT 0,3