Examples with SQL
Example 1: List the products ordered in the last 10 orders in Buffalo city.
In step one we prepared our condition. And the desired values were queried.
Example 2: List the order amount, product amount, and total price of customers.
- The Reason for the usage of “Group by ”; In order to apply the calculation by the desired column in “SELECT”, “Group by” is necessary.
- To see better the calculation by the desired column in “SELECT”, “Order By” is used.
Get Baris Gül’s stories in your inbox
Join Medium for free to get updates from this writer.
Example 3: List the order amount, product amount, and total price in each city.
Example 4: The cities that have revenue lower than the average of the state where the cities are located.
Example 5: Write a query that returns how many days are between the third and fourth-order dates of each staff.








![SQL Interview Quickie #4 — [FAANG] Window Functions (ROW_NUMBER, RANK, DENSE_RANK)](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*PY6J-3yz3fZ5DddqyZ8Tyg.png)
