Results 1 to 11 of 11

Thread: SQL Query

  1. #1
    Join Date
    Oct 2007
    Posts
    13

    Unanswered: SQL Query

    Hi, I am stuck at this query, I am having problems vizulising what I have to do with it could someone help.

    I have a table film
    Season,Title,Director

    Question is no 2 films have been shown back to back but some have been shown after a gap of one year, how do I find these titles?, below is as far as ive got

    select f1.title
    from film f1, film f2
    where f1.season=f2.season

    cheers

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    homework
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2007
    Posts
    13

    Imnot asking for the answer

    Am I on the correct track by joining the table with itself?

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Am I on the correct track by joining the table with itself?
    YES!
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Oct 2007
    Posts
    13

    Thanks

    Cheers for that

  6. #6
    Join Date
    Oct 2007
    Posts
    13
    Hi is this correct?

    select p1.title,p2.season
    from film p1,film p2
    where p1.season=p2.season+2
    and p1.title=p2.title;

    Pleas tell me its correct

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by piston
    Pleas tell me its correct
    actually, you should be able to tell us

    don't you have any good test data?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Oct 2007
    Posts
    13

    r937

    If you dont want to answer then thats fine, no I dont have any way of testing it as it is an oracle sql statement and I dont have oracle or any other tool to check it.

  9. #9
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    how can you possibly be developing a query for a database that you don't have access to?

    i say again: homework!!

    okay, here's a suggestion

    go download mysql -- it's free, it's small, it's fast, and it will let you test your queries (as long as you stick to standard sql, which is really easy, and not try to use any special oracle functions)

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  10. #10
    Join Date
    Oct 2007
    Posts
    13

    Thanks

    I will give that a try. Yes it is homework but I have not asked you to answer the question, as you can see I am trying to do it myself, I was just asking for some guidence by more experienced guys like yourself.

    Cheers

  11. #11
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Perhaps you'd want to download and install a free Oracle database; it is 10g Express Edition. Then you wouldn't have to learn SQL on a piece of paper, but real database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •