SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table students( id int primary key, name varchar(255), mark int); create table depart ( id_stud int, foreign key (id_stud) references students(id), dep varchar(255)); insert into students values (1, 'i', 5), (2, 'he', 5), (3, 'he', 3), (4, 'i', 2), (5, 'i', 2); select name, avg(mark) from students s join depart d on d.id_stud = s.id group by name order by avg(mark)

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear