question

zashwin avatar image
zashwin asked

Please help with the following queries. Rectify if they are wrong.

[Refer this link for the questions>>][1] My answers till now,(by the way I solved them but I am not sure if they are correct, so I wanted to get something like a model answer paper to compare and check.) Answer.2) select name from Artist A where exists(select name from album B where A.name=B.name) Answer.3)select A.name from Atist A, Track T, TrackList L where A.artistID=L.trackID and L.Tracknum=1 and T.name="Intro" Answer.4)select artist.name from Artist where artist.name="Mogwai" and weight>(select weight from Artist,SimilarArtist where Artist.artistID=SimilarArtist.artistID) Answer.5)select A.name from Album A,Tracklist L where L.tracknum>30 and L.albumID=A.albumID M not getting the other answers. So if nething wrong in the above pls rectify. [1]: http://inst.eecs.berkeley.edu/~cs186/fa06/hw/hw3/hw3.pdf
queryjoinsquery-planquery-designer
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
We closed the original question as there was no real substance to it. As posters have said, if the OP wants to post the questions as questions, rather than just a link, we will be happy to help.
1 Like 1 ·

1 Answer

Grant Fritchey avatar image
Grant Fritchey answered
Answer 3 is a cartesian join, so you'll want to look at that. Other than that, are you sure you took the class? I'd strongly suggest you study the provided book a bit more.
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image Håkan Winther commented ·
Maybe he should read your books instead! :)
0 Likes 0 ·
Matt Whitfield avatar image Matt Whitfield ♦♦ commented ·
I wasn't sure, seeing as the course said 'due in 2006'. So I figure either: * a - OP is a time traveller from the future, and probably doesn't need basic SQL help * b - OP is **very** late with homework, so probably won't matter if it's wrong anyway
0 Likes 0 ·
ThomasRushton avatar image ThomasRushton ♦♦ commented ·
I reckon OP is in the wrong place, anyway. Judging by Homework 2, it's a Postgres environment...
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Postgres or not, there's no join criteria for Track in that query. He's going to get some nasty data back.
0 Likes 0 ·