Changes between Version 2 and Version 3 of Напредни извештаи од базата (SQL и складирани процедури)


Ignore:
Timestamp:
02/06/25 14:07:59 (2 weeks ago)
Author:
173067
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Напредни извештаи од базата (SQL и складирани процедури)

    v2 v3  
    223223{{{
    224224WITH MonthlyBookings AS (
    225     -- Count bookings for each destination per month
    226225    SELECT
    227226        DATE_TRUNC('month', b.bookingDate) AS month,
     
    237236
    238237MonthlyFlights AS (
    239     -- Count bookings for each flight per month
    240238    SELECT
    241239        DATE_TRUNC('month', b.bookingDate) AS month,
     
    249247
    250248MonthlyAirports AS (
    251     -- Count departures from each airport per month
    252249    SELECT
    253250        DATE_TRUNC('month', b.bookingDate) AS month,
     
    261258)
    262259
    263 -- Retrieve the top 3 destinations, flights, and airports for each month
    264260SELECT month, 'Destination' AS category, destination_name AS name, bookings_count AS count FROM MonthlyBookings WHERE rank <= 3
    265261UNION ALL