Professional Web Applications Themes

query that uses subqueries - MySQL

Hi, I have to write the following query using SUBQUERIES. Can anybody please help with this. Shall be grateful. "Write a query that returns a list of all flight numbers, their intended destination and other airports in the same destination city that the flight could land at if required." Am pasting the tables below: CREATE TABLE `my-database`.`airports` ( `IATA_CODE` varchar(3) default NULL, `NAME` varchar(30) default NULL, `CTY_IATA_CODE` varchar(3) default NULL, `UTC_OFFSET` decimal(2,0) default NULL, `ICAO_CODE` varchar(4) default NULL, `ROUTE_SWARE_APT_NME` varchar(100) default NULL ) ENGINE=InnoDB DEFAULT CHT=latin1; CREATE TABLE `my-database`.`cities` ( `IATA_CODE` varchar(3) default NULL, `COU_IATA_CODE` varchar(2) default NULL, `NAME` varchar(40) ...

  1. #1

    Default query that uses subqueries

    Hi,

    I have to write the following query using SUBQUERIES. Can anybody
    please help with this. Shall be grateful.

    "Write a query that returns a list of all flight numbers, their
    intended destination and other airports in the same destination city
    that the flight could land at if required."

    Am pasting the tables below:

    CREATE TABLE `my-database`.`airports` (
    `IATA_CODE` varchar(3) default NULL,
    `NAME` varchar(30) default NULL,
    `CTY_IATA_CODE` varchar(3) default NULL,
    `UTC_OFFSET` decimal(2,0) default NULL,
    `ICAO_CODE` varchar(4) default NULL,
    `ROUTE_SWARE_APT_NME` varchar(100) default NULL
    ) ENGINE=InnoDB DEFAULT CHT=latin1;

    CREATE TABLE `my-database`.`cities` (
    `IATA_CODE` varchar(3) default NULL,
    `COU_IATA_CODE` varchar(2) default NULL,
    `NAME` varchar(40) default NULL
    ) ENGINE=InnoDB DEFAULT CHT=latin1;

    CREATE TABLE `my-database`.`flight_profiles` (
    `FLP_ID` decimal(8,0) default NULL,
    `FLT_NUMB` decimal(4,0) default NULL,
    `SEATS` int(11) default NULL,
    `PRICE_CODE` varchar(50) default NULL,
    `FLT_FROM` varchar(50) default NULL,
    `FLT_TO` varchar(50) default NULL,
    `depart` datetime default NULL,
    `arrive` datetime default NULL
    ) ENGINE=InnoDB DEFAULT CHT=latin1;

    Thanks
    ros

    ros Guest

  2. #2

    Default Re: query that uses subqueries

    On Apr 18, 10:14 pm, ros <com> wrote: 


    If YOU have to do it, why are YOU asking US?

    strawberry Guest

  3. #3

    Default Re: query that uses subqueries

    On Apr 18, 2:18 pm, strawberry <com> wrote: 







    >
    > If YOU have to do it, why are YOU asking US?[/ref]

    O I am sorry, I just wanted a high-level description so that I could
    get started. I am new to programming, databases etc. I am trying this
    book Visual Quickstart guide but if I have a high-level understanding
    then I could start and then seek help her on a more specific issue.
    Thanks
    ros

    ros Guest

  4. #4

    Default Re: query that uses subqueries

    ros schrieb: 

    I'll try.

    In a SELECT statement, wherever you'd write a field, you can use another
    query in parentheses.
    For the gory details, Google for "subquery site:dev.mysql.com" and you
    shall find.

    Hope that's the level you're aiming at...

    Regards,
    Jo
    Joachim Guest

  5. #5

    Default Re: query that uses subqueries

    On Apr 19, 12:47 am, Joachim Durchholz <org> wrote: 
    >
    > I'll try.
    >
    > In a SELECT statement, wherever you'd write a field, you can use another
    > query in parentheses.
    > For the gory details, Google for "subquery site:dev.mysql.com" and you
    > shall find.
    >
    > Hope that's the level you're aiming at...
    >
    > Regards,
    > Jo[/ref]

    Thanks for the advice Joachim. I found a tutorial by "google-ing" and
    am going through that. I'll try this query in a bit and then post for
    all you guys' advice.

    Ros

    ros Guest

  6. #6

    Default Re: query that uses subqueries

    On 18 Apr 2007 14:18:50 -0700, strawberry wrote: 

    It must be homework season again...

    --
    It's not hard, it's just asking for a visit by the up fairy.
    -- Peter da Silva
    Peter Guest

Similar Threads

  1. Using COALESCE for subqueries
    By marty3d in forum MySQL
    Replies: 1
    Last Post: June 15th, 09:02 PM
  2. Joins or subqueries
    By alexford in forum Coldfusion Database Access
    Replies: 1
    Last Post: April 26th, 02:31 AM
  3. subqueries in query of queries
    By helenmhudson in forum Coldfusion Database Access
    Replies: 2
    Last Post: March 7th, 04:25 PM
  4. DBI and subqueries in mysql 4.1
    By Marc Lambrichs in forum PERL Modules
    Replies: 2
    Last Post: December 13th, 08:03 PM
  5. Why are subqueries recongized as dependencies
    By Chris Becker in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 8th, 07:40 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139