RANK()
window function to assign a rank to each order for each customer based on the order date in descending order.Customers
and Orders
tables on the customer_id
field.erDiagram CUSTOMERS { int customer_id PK "Unique customer identifier" varchar name "Customer's name" } ORDERS { int order_id PK "Unique order identifier" date order_date "Date when the order was placed" int customer_id FK "Identifier for the customer who made the order" int cost "Cost of the order" } CUSTOMERS ||--o{ ORDERS : places