Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    9

    Unanswered: Implementing Using SQL

    Hi,
    Im revising for an exam so I need someone to help me with two statements im having trouble with.

    Q) Write a SQL statement to produce a list of all the vehicles which were rented out after the 17 September 2010 for a total rental cost of 120.
    a)
    SELECT car_license_no, car_make......rental_date_out
    FROM rental
    WHERE rental_date_out > '17-SEP-10'
    AND total_sum = 120 ;

    Q) Write a SQL statement to produce a list of the registration numbers of the vehicles which were collected before the 12 August 2010 along with the dates when they were returned. To this list, add the registration number of those vehicles which were never rented out.
    a) really dont know....

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    OK so first off develop your query using joins
    MySQL :: MySQL 5.0 Reference Manual :: 12.2.8.1 JOIN Syntax
    ignore the requirement for vehicles not rented out (for now)
    you need to find a way to LIMIT the rows returned (y6ou only want one row per vehicle)
    MySQL :: MySQL 5.5 Reference Manual :: 12.2.9 SELECT Syntax

    then revisit the join syntax and find out which vehicles were rented
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2011
    Posts
    11
    give me tables and der fields..i will help u out..

  4. #4
    Join Date
    Dec 2010
    Posts
    9
    I dont understand, what would the join sysntax do? The columns I need are in one table so I wont need the join syntax?

    SELECT car_license_no, rental_date_out, rental_date_returned
    FROM rental
    WHERE '12-AUG-2010'
    [now I need to add vehicles which were never rented out] is this even possible? They cant be listed next to ^that^ statement because those are vehicles which were rented out.

  5. #5
    Join Date
    Jul 2010
    Location
    ISHHHH
    Posts
    130
    nice links
    Quote Originally Posted by healdem View Post
    OK so first off develop your query using joins
    MySQL :: MySQL 5.0 Reference Manual :: 12.2.8.1 JOIN Syntax
    ignore the requirement for vehicles not rented out (for now)
    you need to find a way to LIMIT the rows returned (y6ou only want one row per vehicle)
    MySQL :: MySQL 5.5 Reference Manual :: 12.2.9 SELECT Syntax

    then revisit the join syntax and find out which vehicles were rented
    WiTh Tnks & ReGaRdS
    mAtHuKuMaLi

Posting Permissions

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