Author |
Topic |
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 15:53:13
|
Suppose you have a table by the name of BOOK B columns including BOOK_CODE, TITLE, PUBLISHER_CODE, TYPE, PRICE, PAPERBACK.Then you have another table called PUBLISHER P columns including PUBLISHER_CODE, PUBLISHER_NAME, CITYQuestion:List the book title for each book that has the type PSY and that is published by Berkley Publishing?I am working with multiple tables.I need someone to help me and explain maybe. Please. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 15:56:57
|
SELECT TITLEFROM BOOKWHERE EXISTS(SELECT *FROM PUBLISHER P WHERE TITLE = 'Berkley'and TYPE = 'PSY'); |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 15:59:04
|
SELECT TITLEFROM BOOKWHERE EXISTS(SELECT *FROM PUBLISHER P, book b WHERE p.publisher_name = 'Berkley'and b.TYPE = 'PSY'); |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 16:06:39
|
Should I use an EXISTS? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 16:11:15
|
Thank you very much Tara. This semester is definitely a struggle for me. I am in my second year of school trying to achieve my associates degree in Web Technologies. Thanks again. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-11 : 22:06:50
|
Tara,By the way, I wanted to let you know that I figured it out. I was using 'Berkley' as 'Publisher_code' when I should of used 'BP' in my where statement. The common factor was not Publisher_Name rather Publisher_code. I got the whole select statement as:SELECT TITLE FROM BOOK B JOIN PUBLISHER P ON B.PUBLISHER_CODE = P.PUBLISHER_CODE WHERE P.PUBLISHER_CODE LIKE 'BP' AND B.TYPE LIKE 'PSY'; which gave me the correct answer. Thank you again for helping me.DM |
|
|
|