SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table students ( class int, rang int ); insert into students values (1,3), (1,4), (1,5), (2,5), (2,5); select class from students group by class having count(*)*5 = sum(rang); SELECT class, min(rang) AS m FROM students GROUP BY class HAVING min(rang) = 5; select distinct s.class from students s left join students s1 on s1.class = s.class and s1.rang < 5 where s1.class is null;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear