Changes between Version 6 and Version 7 of izvestai


Ignore:
Timestamp:
01/29/25 20:47:40 (27 hours ago)
Author:
213209
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • izvestai

    v6 v7  
    1414
    1515    COUNT(CASE WHEN rh.cancellation_reason = '/' THEN 1 END) AS succesfull_by_user_per_restaurant,
    16    
    17     COUNT(CASE WHEN rh.cancellation_reason = 'Canceled by restaurant' THEN 1 END) AS canceled_by_restaurant,
    1816
    1917    COUNT(rh.cancellation_reason) AS total_cancellations_per_restaurant
     
    3735
    3836{{{
    39 SELECT r.restaurantId, r."name", COUNT(res.reservationId) AS totalReservations
     37SELECT
     38        r.restaurantId,
     39        r."name",
     40        COUNT(res.reservationId) AS totalReservations
    4041FROM restaurants r
    4142JOIN reservations res ON r.restaurantId = res.restaurantId
     
    4344ORDER BY totalReservations desc
    4445}}}
     46
     47== Извештај за просечна големина на група, максимална и број на резервации за во последниот месец
     48{{{
     49SELECT
     50    r."name" AS restaurant_name,
     51    ROUND(AVG(rh.party_size), 1) AS average_party_size,
     52    MAX(rh.party_size) AS max_party_size,
     53    COUNT(*) AS number_of_reservations
     54FROM reservation_history rh
     55JOIN "tables" t ON t.tableid = rh.table_id 
     56JOIN restaurants r ON r.restaurantid = rh.restaurant_id
     57WHERE rh.reservation_datetime  >= (CURRENT_DATE - INTERVAL '1 month')
     58GROUP BY r."name"
     59ORDER BY average_party_size DESC;
     60}}}
     61