clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1305693 fiddles created (20211 in the last week).

CREATE TABLE Students ("NAME" varchar2(6)) ;
 hidden batch(es)


INSERT ALL INTO Students ("NAME") VALUES ('Adam') INTO Students ("NAME") VALUES ('Bennet') INTO Students ("NAME") VALUES ('Elmer') INTO Students ("NAME") VALUES ('Justin') INTO Students ("NAME") VALUES ('Louis') INTO Students ("NAME") VALUES ('Noah') INTO Students ("NAME") VALUES ('Jack') SELECT * FROM dual ;
7 rows affected
 hidden batch(es)


CREATE TABLE Teachers ("NAME" varchar2(5)) ;
 hidden batch(es)


INSERT ALL INTO Teachers ("NAME") VALUES ('Leo') INTO Teachers ("NAME") VALUES ('Kyle') INTO Teachers ("NAME") VALUES ('Ethan') SELECT * FROM dual ;
3 rows affected
 hidden batch(es)


with tch as ( select t.*, row_number() OVER ( ORDER BY name ) as n from teachers t ), ct AS ( select count(*) as cnt from Teachers ) select s.name,tch.name from ( SELECT name, NTILE(cnt) OVER (partition by cnt ORDER BY name) AS n FROM Students cross join ct ) s join tch on tch.n = s.n;
NAME NAME
Adam Ethan
Bennet Ethan
Elmer Ethan
Jack Kyle
Justin Kyle
Louis Leo
Noah Leo
 hidden batch(es)