question

bsbin avatar image
bsbin asked

Sql Question

Hi Guys, Please help me to solve the SQL question below? Thanks
sqlexam-question
sql-question.jpg (34.6 KiB)
7 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.

to be fair he did put exam-question in the tags :)
2 Likes 2 ·
C'mon. Take the time to type the question out, and we might take the time to help you. It's a fair ask.
1 Like 1 ·
I can see the picture but what's the question, join the tables and create a statement to give the results on the right perhaps?
0 Likes 0 ·
Thank you! I have 3 tables : Leads, Advertisment, webites as you can see at the picture? And I need to get the table from the right side that contains two columns (website_name and #unique leads)
0 Likes 0 ·
Obvious homework is obvious.
0 Likes 0 ·
Show more comments
half fast dba avatar image
half fast dba answered
The query will be something along the lines of.................... select website_name , count (distinct Email) from Leads as L inner join Advertisement as A on L.Advertisement_id = A.Advertisement_id inner join Websites as W on A.website_id = A.website_id This looks like homework. Next time rememeber solving the problem yourself is where you learn. Good Luck!
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.

Thank you! It's not a homework :) I got this question in some interview. This answer will not work because I need only unique leads.
0 Likes 0 ·
Mart avatar image
Mart answered
Hi again bsbin Didn't want to give you the directly, more how to get there yourself: Take a look at these links, pretty sure they'll allow you to build the statement yourself and hence understand it too. [ http://www.w3schools.com/sql/sql_join.asp][1] [ http://www.w3schools.com/sql/sql_func_count.asp][2] [ http://www.w3schools.com/sql/sql_distinct.asp][3] [1]: http://www.w3schools.com/sql/sql_func_count.asp [2]: http://www.w3schools.com/sql/sql_func_count.asp [3]: http://www.w3schools.com/sql/sql_distinct.asp
10 |1200

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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