Re: Oracle question

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 19 Jan 2003 12:05:39 GMT
Message-ID: <b0e4aj$nd85p$2_at_ID-82536.news.dfncis.de>


>
> I just completed my first class in Oracle and for my final
> project I built
> a music CD database. I have a table called "songs" which has the
> song title
> and the running time (among other fields) and a table called
> "album" which
> links to the "songs" table. What is the best way to define the duration
> of every song?
>
> Thank you for your support.
>
> --
> Posted via http://dbforums.com

Assuming the running time is stored in seconds:

create table album (
  album_id number primary key,
  descr varchar2(50)
);

create table song (

  album_id     references album,
  descr        varchar2(50),

  running_time number
);

select
  sum(song.running_time),
  album.descr
from
  album, song
where
  album.album_id = song.album_id
group by
  album.descr,album.album_id;

-- 
  no sig today
Received on Sun Jan 19 2003 - 13:05:39 CET

Original text of this message