Max amount of planes in the air simultaniously - giving arrival and departuetime

hi!
I use oracle 11g and I have a SQL Server table with a flight field (flightNo) and  two datetime fields (Departuredatetime, Arrivaldatetime).
How is it possible to query the max amout of planes being in the air simultaniously in a certain timeperiode? result should provide the datetime of this maximum also.
Example:
flight55:         |------|
flight67:              |--------------------|
flight69:                  |--|
flight88:                              |-----------|
result:
timestamp     no of planes
09:34             3
sorry I can't provide an insert because I am beginner and have only read access to the database.
thank you so much!

Maybe for a complete solution some Tabibitosan is needed :-)
Otherwise consecutive time slots will be shown as distinct rows.
Let's modify Karthik's example data (flight 1 arrives one our later)
DROP TABLE flight_time_table;
CREATE TABLE flight_time_table
  flight_no  INTEGER
, start_time DATE
, end_time   DATE
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH:MI:SS AM';
INSERT INTO flight_time_table(flight_no, start_time, end_time)
VALUES (1, '14-JAN-2013 12:00:00 AM', '14-JAN-2013 05:00:00 AM');
INSERT INTO flight_time_table(flight_no, start_time, end_time)
VALUES (2, '14-JAN-2013 02:00:00 AM', '14-JAN-2013 10:00:00 AM');
INSERT INTO flight_time_table(flight_no, start_time, end_time)
VALUES (3, '14-JAN-2013 05:00:00 AM', '14-JAN-2013 06:00:00 AM');
INSERT INTO flight_time_table(flight_no, start_time, end_time)
VALUES (4, '14-JAN-2013 08:00:00 AM', '14-JAN-2013 12:00:00 PM');
COMMIT;
WITH  got_in_air_cnt  AS (
    SELECT    start_time
             ,LEAD (start_time) OVER (ORDER BY start_time)  AS end_time
             ,SUM (SUM (net_change))
                 OVER (ORDER BY start_time)  AS in_air_cnt
    FROM      flight_time_table
    UNPIVOT   (    start_time
              FOR  net_change  IN  ( start_time  AS  1
                                   , end_time    AS -1
    GROUP BY  start_time
,numbered_count AS(
    SELECT  start_time
           ,end_time
           ,in_air_cnt
           ,CASE WHEN start_time <> LAG(end_time,1,DATE '0001-01-01') OVER (ORDER BY start_time)
              OR in_air_cnt <> NVL(LAG(in_air_cnt,1,NULL) OVER (ORDER BY start_time),in_air_cnt)
            THEN
                ROW_NUMBER() OVER (ORDER BY start_time)
            END rn
    FROM    got_in_air_cnt
,grouped_count AS(
    SELECT  start_time
           ,end_time
           ,in_air_cnt
           ,MAX(rn) OVER (ORDER BY start_time) grp
    FROM    numbered_count
,got_rnk AS (
    SELECT  MIN(start_time) start_time
           ,MAX(end_time) end_time
           ,in_air_cnt
           ,RANK () OVER (ORDER BY  in_air_cnt  DESC)  AS rnk
    FROM    grouped_count
    GROUP BY grp
            ,in_air_cnt
SELECT  start_time
       ,end_time
       ,in_air_cnt
FROM    got_rnk
WHERE   rnk  = 1
ORDER BY  start_time
START_TIME               END_TIME                 IN_AIR_CNT
14-JAN-2013 02:00:00 AM  14-JAN-2013 06:00:00 AM           2
14-JAN-2013 08:00:00 AM  14-JAN-2013 10:00:00 AM           2
I use the max-on-case-row-number version of Tabibitosan from About Oracle: Tabibitosan
Regards
Marcus

Similar Messages

  • Exciting times with the Air Disk: Drive format and Remote access

    What a great addition to the Air Port.
    Tell me this, since the Air Port extreme is Mac+PC compatible, can my external drive be formated NTFS and still work with a Mac on the network?
    Also, can someone point me to a resource for accessing the Air Disk remotely? This sounds fantastic!! I keep my iTunes library on an external drive, with Air Disk I could access (stream?) the files remotely, no?
    Steve

    Apple has not published any of these details AND the devices haven't shipped yet.
    So no one here knows the answers to these questions.

  • HT1554 I have a macbook pro and just got an air and I have started the Air but stuffed up and didnt transfer everything from my old computer to the new one. they have different passwords and names. help, Ive got no idea here...

    I set up my new air and now want to transfer my info from my macbook pro and I seem to have missed the boat and want to go back and do it . the computers are in different names with diff. passwords. Any idea?

    If you set yp the Air before transfer, look in Users or Accounts pref pane to see if the other user is there to login to.

  • I tired to change the billing info on the app on my phone and it kept saying it was unable to process my request, then when i tried to change it on my laptop it said i reached the max amount of update attempts. how do i fix this and change my billing info

    help

    Change the email on the old account to another new, current email address.
    An email address can only be linked to one Apple ID.
    It is possible to have content from multiple Apple ID's on a single iDevice.

  • I have two Win 7 PCs running iTunes 10.7.0.21 one is a 64 bit maching and the other is a 32 bit.  I can see the Air Play on both and can see the AE speakers, however, for some reason I can not select any speakers except the PC speakers on the 32 bit PC.

    This problem only started after I updated iTunes to version 10.7.0.21.  Never had a problem with the AE speakers until now.  Funny no problem on my 64 bit PC only the 32 bit one.

    If you are running win 7, i had this problem come up when i updated my itunes 10.7, btw it now runs like a dog, on slighty older hardware in win 7, hopefully version 11 fixes this!!!!!!
    Go here, apparently firewall settings for itunes can be reset, so you need to add back in udp access, and change it to public.
    http://blog.forret.com/2010/10/fix-for-error-15000-remote-speakers-on-itunes-win dows-7/

  • Max amount of ram

    What is the max amount of ram, which the hp g72 b15sa laptop can support?
    On the hp website it says 4GB max, 2GB per slot. But on a review about this laptop, it says the hp g72 b15sa can support 8GB max, 4GB per slot. Which one is correct?
    laptop make and model: Hp G72 B15SA
    operating system: Windows 7 64bit
    This question was solved.
    View Solution.

    This is from the Service Manual:
    Supports up to 8 GB of system memory √ √
    Supports the following configurations:
    ● 4096 MB (2048 MB × 2) √ √
    ● 3072 MB (1024 MB × 1 + 2048 MB × 1) √ √
    ● 2048 MB (2048 MB × 1) √ √
    ● 2048 MB (1024 MB × 2) √ √
    ● 1024 MB (1024 MB × 1) √ √
    The checkmarks are for the discrete graphics and UMA graphics model (which you have), so yours can take 8 gigs. HP just does not sell the G72 in any version with 8 gigs. At the low prices I have seen recently I can think of no excuse not to install 8 gigs. Just do not expect a lot of noticeable difference over 4 gigs.

  • In service centre report my phone has minor liquid damage. just because of this warranty is denied.  In this part of the country, there is moisture in the air.  Apple cant run away as it is minor moisture. no email address of any official where to write.

    This issue was discussed with customer support on 21.12.2011 and I was told that as a special case my phone wil be replaced and I should handover my phone to a service station.  After keeping my phone Apple has deeclined.  reason best known to them.

    As Allan says, high humidity alone will not cause the sensors to trip. Now... If it is SO humid that moisture is condensing out of the air on to surfaces and objects (walls, furniture, cars, etc.) then I suppose it could also condense out of the air inside the phone. The casing is not air tight. If it were, liquid would not be a problem.
    My guess is they were willing to give you the benefit of the doubt. After opening the phone, they found out that you lied when you told them you did not immerse it in liquid.

  • Over-the-air(how turn off?)

    hi,
    i was trying to sync my bookmarks from safari with my iphone using iTunes
    but is not possible because over-the air in on.where and how i turn off over the air?
    thx

    If the OP voices a Wi-Fi issue then how can Wi-Fi not be relevant to THEIR solution?
    Read his post again, The OP never said anything about WiFi, which has nothing to do with this. "Over the air" can mean cell network, Bluetooth or WiFi.
    Apparently, he has MobileMe syncing for Safari bookmarks, and when this is active iTunes Safari syncing is disabled. MobileMe push syncing isn't WiFi specific - it's also carried by the cell data network.
    Message was edited by: modular747

  • Can an ADT-packaged native installer install the AIR runtime in silent mode?

    Silent installation of my app works fine when the runtime is installed, as follows:
    <path>\MyApp.exe -silent -location "\"C:\Program Files\MyApp\"" -desktopShortcut -programMenu
    However, if the runtime is not installed, the invocation does nothing. I've also tried -eulaAccepted.
    Is it possible to silently install the app, yet if the runtime is not installed, initiate the runtime install automatically from adobe, preferably with a eula prompt for the user?
    Worst case, if the runtime must be bundled in the package, is a sidecar install supported for native installers?
    I should note, I cannot package the app as .air. The app uses NativeProcess and bundles an exe.
    Thanks.

    chris.campbell wrote:
    Dmitry Svetlakov wrote:
    I try use silent mode under Mac OS - doesn't work in this situation: Adobe AIR not installed on system.
    Because isntaller needs in access from administrator.
    Log:
    Jul 18 15:36:01 user-macbook-pro /var/folders/f+/f+YgX8A8EzyL0WM6aZ2rT++++TI/-Tmp-/airNEZFRK/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer[8694]: Could not create directory at /Applications/Adobe/Flash Player/AddIns/airappinstaller
    Jul 18 15:36:01 user-macbook-pro /var/folders/f+/f+YgX8A8EzyL0WM6aZ2rT++++TI/-Tmp-/airNEZFRK/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer[8694]: Error occurred during copy and set resource fork operation; beginning rollback: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Unhandled exception Error: Could not create directory /Applications/Adobe/Flash Player/AddIns/airappinstaller" errorID=3001]
    Jul 18 15:36:09 user-macbook-pro /var/folders/f+/f+YgX8A8EzyL0WM6aZ2rT++++TI/-Tmp-/airNEZFRK/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer[8694]: Rollback complete
    Jul 18 15:36:09 user-macbook-pro /var/folders/f+/f+YgX8A8EzyL0WM6aZ2rT++++TI/-Tmp-/airNEZFRK/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer[8694]: Got an unexpected fatal error while in stateInstalling: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Unhandled exception Error: Could not create directory /Applications/Adobe/Flash Player/AddIns/airappinstaller" errorID=3001]
    Jul 18 15:36:09 user-macbook-pro /var/folders/f+/f+YgX8A8EzyL0WM6aZ2rT++++TI/-Tmp-/airNEZFRK/Adobe AIR Installer.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer[8694]: Application Installer end with exit code 7
    Hi Dmitry,
    Are you trying to sub launch AIR silently through your installer?  If so, and you haven't already, please fill out the AIR distribution agreement form and you'll receive documentation that discusses silent installs and uninstall's.
    If you are just trying this out, you are correct that the runtime needs admin access.  You can achieve this by prefixing your command line with sudo.
    Thanks,
    Chris
    Yes, but that not decide our task: create custom installer from air app native installer. I hope you understand that i mean. This installer should work for anyone user - and have to install Adobe AIR Runtime.

  • The .air installer file of my application is damaged.

    Hi all,
    I am a developer for a desktop application to be installed in windows and mac. The air file is signed and migrated to new certificated as detailed here (Adobe AIR 1.5 * Signing an AIR file to change the application certificate). But while launching the installer in windows, the installer fails with the message "The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author." I have tried doing the following
    - checked my date/time
    - uninstalled/reinstalled the application
    - removed the installtion folder  etc.
    But still the issue persists. Before failing, it also shows a dialogue that the "publisher identity is verified" - so I believe this issue is not related with codesigning/certificates, please correct me if I'm wrong.
    Please let me know how to resolve this issue.
    Thanks,
    VivekS

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

  • Do you need to sync the iPhone through iTunes if you sync over the air?

    Do you need to sync the iPhone through iTunes if you sync over the air?
    My MacBook Pro and iPhone 3G with OS 4 synchronize with each other over the air through my Snow Leopard Server. Though when I connect it to iTunes I see that it allows me to checked "Synchronize with this computer" type options and I'm confused as to why that would be if they're synchronizing over the air.
    Can someone help clarify when those should be checked? Because I do want everything that's on my computer synchronized with my iPhone and vice versa, but if I add the accounts on my phone manually that seems to work too.

    In regards to syncing contacts and calendar events, if you are syncing this data over the air on your iPhone and the contacts and calendar events synced over the air on your iPhone match the Address Book and iCal data on your Mac, there is no reason to sync this data direct with the Address Book and iCal on your Mac via the iTunes sync process.

  • 7/16/2012 - AIR 3.4 Runtime and SDK Beta 1

    The beta 1 release provides access to the AIR 3.4 runtime and SDK for Windows, Mac OS, iOS and Android. The key features and benefits of AIR 3.4 are:
    iOS 5.1 SDK Support — Build your AIR on iOS applications by default with iOS 5.1 SDK (without using the --platformsdk switch) and leverage the enhancements available in iOS 5.1 SDK.
    Exception Support in Native Extensions for iOS — A native extension for iOS can now use both C++ and Objective-C exceptions.
    iOS Push Notifications — This feature will use APNS (Apple Push Notification Service) and a provider (third-party server which will communicate with the APN) to generate notifications.
    AIR direct deployment (without iTunes) — Deploy an AIR application on iOS devices without having to use iTunes or the iPhone configuration utility.
    You can find instructions for getting started with this release here: AIR 3.4 Labs Page
    We encourage you to let us know what you think over on our AIR 3.4 Labs Forum

    Excellent, glad you were able to get this to work!  Had you tried right clicking the installer and doing a "run as administrator"?

  • 5/4/2012 - AIR 3.3 Runtime and SDK Beta 3

    The beta 3 release provides access to the AIR 3.3 runtime and SDK for Windows, Mac OS, iOS and Android. The key features and benefits of AIR 3.3 are:
    USB debugging for AIR iOS — This new feature allows the iOS developer to connect to the desktop via USB while debugging their mobile applications instead of relying on network connectivity.
    Enhanced Background behavior for AIR iOS — Background support now more closely resembles native applications in iOS. In addition to some basic multitasking and background audio support that is already enabled with AIR for iOS, applications may now support location updates and networking in the background, as well as being notified when a background app is about to be suspended by the operating system.
    Stylus support for Android 4.0 — Stylus support in Flash takes advantage of the new-in-4.0 Android Stylus API, so that stylus-aware apps work automatically with any devices supporting the Android API set.
    Simulator Support (Mac) — With the enhanced simulator support a developer can now package and run an application on iOS simulator using ADT commands. This feature allows an iOS developer to develop and run an application without needing an actual set of devices by using the iOS simulator using Xcode.
    Aspect Ratio Enhancements — With AIR 3.3 the issue with the runtime ignoring the specified aspect ratio has been resolved. In this release we address this use-case by allowing only screen orientation corresponding to app specified aspectRatio and orientation corresponding to 180 degree device rotation from the specified aspectRatio.
    Improved Mac App Store Support — Added support to ensure Mac AIR apps adhere to Apple guidelines and can be submitted to the Mac App store successfully.
    You can find instructions for getting started with this release here: AIR 3.3 Labs Page
    We encourage you to let us know what you think over on our AIR 3.3 Labs Forum

  • 9/26/2012 - AIR 3.5 Runtime and SDK Beta

    The beta release provides access to the AIR 3.5 runtime and SDK for Windows, Mac OS, iOS and Android.
    The primary goals of this release are bug fixing, adding Jellybean support, and iOS app enhancements.
    Below are some of the key features and benefits of AIR 3.5:
    Debug stack trace in release builds of Flash Player — This feature enables developers to display stack trace info in release and debug builds.
    Packaging Multiple Binaries — This feature enables developers to include third party static libraries and frameworks and package these with ANE.
    Shared ByteArray support for ActionScript Workers — This feature enables developers to share memory between multiple workers.
    Packaging and loading multiple SWFs on iOS — This feature will allow developers to load multiple swfs, that contain ActionScript bytecode on iOS .
    You can find instructions for getting started with this release here: AIR 3.5 Labs Page
    We encourage you to let us know what you think over on our AIR 3.5 Labs Forum

  • 5/14/2013 - AIR 3.7 Runtime and SDK Update

    Today, the AIR 3.7 Runtimes and SDK's were updated to address stability and performance issues, in particular the following problems have been addressed:
    Apache Flex fails to compile when using AIR 3.7 (3529847)
    AIR 3.7.0.1860 Runtime for Windows
    AIR 3.7.0.1860 Runtime for Macintosh
    AIR 3.7.0.1860 SDK and Compiler for Windows
    AIR 3.7.0.1860 SDK and Compiler for Macintosh
    AIR 3.7.0.1860 SDK for Flex projects on Windows
    AIR 3.7.0.1860 SDK for Flex projects on Macintosh
    For full details on the 3.7 release, please see our release notes.

Maybe you are looking for