Relational algebra , tried everything, just don't know how to do this -
the following relational tables/schemes given:
in bold primary key, in italics foreign key:
-city(name,country,population)
-venue(vid,capacity,name)
-concert(kid,id,did,duration)
-performer(id,kid,age,name)
-ticket(tid,kid,price,type)
now assignment find concerts there more vip tickets other tickets. vip of attribute type, in tickets. have thought problem while. main idea group kid,type,count(*) in (tickets) , somehow add tickets of type != vip , select less vip tickets, don;t know how formally..
something work:
select concert.name concert inner join ticket on concert.kid = ticket.kid (select count(concert.kid) concert inner join ticket on concert.kid = ticket.kid type = 'vip') > (select count(concert.kid) concert inner join ticket on concert.kid = ticket.kid type != 'vip')
Comments
Post a Comment