Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as SQL by rippi ( 19 years ago )
drop table parent;
drop table person;

create table person (
	pid integer not null primary key,
	name varchar(30) unique not null
);

create table parent (
	parentid integer not null references person(pid),
	childid integer not null references person(pid),
	primary key (parentid, childid)
);

insert into person (pid, name) values
(0, 'Bob'), (1, 'Alice'), (2, 'Peter'), (3, 'Paul'), (4, 'Mary');

insert into parent (parentid, childid) values
(0, 1), (0, 2), (2, 3), (2, 4);

 

Revise this Paste

Children: 91380
Your Name: Code Language: