sql server - Relational algebra and SQL solving -


using following relations:

consultant(id,name,skill)   customercompany(id,name address, phone, email, webaddr,market)  project(id,startdate,enddate,consultantid,customerid,days)  invoice(id,date,customer,amount,status) 

im trying work out following scenario using sql , relational algebra

find names of consultants , names of customers, consultant has worked customer, , customer received invoice in range of gbp 100k 200k

using sql have:

select i.amount, c.name customercompany c, invoice i.customer=c.id , >all(select c.name, con.name customercompany, con consultant i.amount between 100 , 200);

relational algebra:

amount = σ(invoice, amount>=100 , amount<=200)  joininv= Ⓧ(amount, customer, customercompany, id)  joincon Ⓧ(joiniv, consultant id, project, consultantid)  π =(joincon, name, name) 

i wondering if write or wrong?

thanks help!

this trick

select  con.name customercompany custcomp inner join project pro on pro.customerid=custcomp.id inner join consultant con on con.id=pro.consultantid inner join invoice inv on inv.customer=custcomp.name inv.amount between 100 , 200 

join


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -