PR4 links- For whoever helps me understand this simple SQL prob!!!

Discussion in 'Programming' started by joey112, Oct 27, 2007.

  1. #1
    1.Display the titles of all books which were written by author with last name of Pratt. Order the list alphabetically by book title.

    Select Book.Title,Author.Author_Last
    From Book,Author
    Where author_last='Pratt'
    Order by title;

    output : Comes up with column headings, "title and author_last" and thats it. No rows or anything.

    2. for each book, list the book title and the publishers name. Order the list alphabetically by book title.

    Select Distinct Book.Title,Publisher.Publisher_name
    From Book,Publisher
    order by title asc

    result:comes up with columns "title and publisher name" and no rows or other output
    3. list the book code, book title and the total number of copies on hand of each book. Order the list by book code.

    select Distinct book.book_code,book.TITLE,Inventory.on_hand
    from book,inventory
    order by book_code;

    result:comes up with columns "book code, title, on hand.


    Conclusion : The codes are correct and are being accepted and run by oracle. I was wondering whether you think these successfully answer the questions. My main concern is, the only output that comes up for each query is "2 or 3 columns with no rows of info". Just need clarity that the codes are right and is the output only meant to show column names and no rows?

    Please tell me if you see any errors.

    For help i will give PR4 links.
     
    joey112, Oct 27, 2007 IP
  2. joey112

    joey112 Guest

    Messages:
    2,250
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Please i have an assign due in 2 hours. I need to know whats happening with the output. Why its only putting up a couple of column names and no rows. And also if this is just what happens and the code is correct? Any help would be greatly appreciated.
     
    joey112, Oct 27, 2007 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Given you arent getting an error there wouldnt appear to be a problem with the structure of the queries. The fact it is returning no rows would suggest that there are no rows to return that match the search criteria - have you made sure the db itself is actually populated?
     
    AstarothSolutions, Oct 28, 2007 IP
  4. joey112

    joey112 Guest

    Messages:
    2,250
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Not to sure. Im doing a beginners course. If their is a problem with the database than thats fine, the main thing is the queries are correct.

    yes i thought it was weird. because their was no error messages, the columns showed but no rows. I presume im right. Thanks for the info.
     
    joey112, Oct 28, 2007 IP