Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table historic
- (
- id serial not null
- constraint table_name_pkey
- primary key,
- film_name varchar,
- category varchar,
- time_utc timestamp
- )
- ;
- create unique index table_name_id_uindex
- on historic (id)
- ;
- create table measurements
- (
- id serial not null
- constraint measurements_pkey
- primary key,
- historic_rowid integer not null
- constraint measurements_historic_id_fk
- references historic,
- measurement double precision
- )
- ;
- create unique index measurements_id_uindex
- on measurements (id)
- ;
- SELECT h.film_name, h.category, m.measurement, h.time_utc
- FROM historic h
- LEFT JOIN measurements m on m.historic_rowid == h.id
- WHERE h.category = 'sci-fi';
- film_name, category, measurement, time_utc
- film_name, category, measurement, time_window
- ---------------------------------------------
- film_a, sci-fi, 0.234234, 0_to_15
- film_b, sci-fi, 0.692859, 15_to_30
- film_c, sci-fi, 0.875854, 30_to_45
- film_d, sci-fi, 0.583465, 45_to_60
- film_e, sci-fi, 0.265334, 60_to_75
- film_f, sci-fi, 0.152545, 75_to_90
- ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement