oracle aide

September 1, 2011

Made simpler: a select from a table with a multi-column composite primary key

Filed under: sql — Tags: — oracleaide @ 4:46 pm

Let’s say we have a table full of smurfs with a 3 – column primary key

create table smurfs (smurf_id int, action_date date, action_sequence int, action varchar2(30));
create index pk_smurfs on smurfs (smurf_id, action_date, action_sequence);
alter table smurfs add constraint pk_smurfs primary key (smurf_id, action_date, action_sequence);

Sample data:


Blog at