Skip to content

Instantly share code, notes, and snippets.

@rich
Created July 21, 2009 02:29
Show Gist options
  • Select an option

  • Save rich/151063 to your computer and use it in GitHub Desktop.

Select an option

Save rich/151063 to your computer and use it in GitHub Desktop.
create table categories (
id serial,
parent_id int4 references categories (id),
name varchar(100),
primary key (id)
);
insert into categories (name) values ('one'), ('two'), ('three');
insert into categories (parent_id, name) values (1, 'cat'), (1, 'dog'), (1, 'bird'), (3, 'no'), (3, 'yes'), (3, 'maybe'), (8, 'good'), (8, 'bad'), (8, 'evil'), (4, 'diabetes'), (4, 'wilford brimley');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment