Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

example on creating a query

Status
Not open for further replies.

room24

Programmer
Dec 28, 2003
83
JM
i have these tables below

create table artiste (art_id number primary key,
first_name varchar2(20),
last_name varchar2(20),
stage_name varchar2(20),
home_number varchar2(15),
cell_number varchar2(10));

create table songs (son_id number primary key,
name varchar2(50),
year number,
price number(5),
length number(3),
genre varchar2(20));


create table records_album (art_id number references artiste,
alb_id number references albums,
primary key (art_id, alb_id));

create table records_song (art_id number references artiste ON DELETE CASCADE,
son_id number references songs ON DELETE CASCADE,
primary key (art_id, son_id));


create table consists_of(alb_id number references albums ON DELETE CASCADE,
son_id number references songs ON DELETE CASCADE,
primary key (alb_id, son_id));






how would i write a query to find the name of all songs recorded by ashanti since the year 2002
 
SELECT s.* FROM songs AS s, artiste AS a, records_song AS rs WHERE a.first_name = 'ashanti' AND rs.art_id = a.art_id AND s.son_id = rs.son_id AND s.year >= 2002
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top