Write 5 advance LeetCode questions for SQL.
Sure, here are 5 advanced LeetCode questions for SQL:

1. Suppose you have a table named "orders" with columns "order_id", "customer_id", "order_date", and "amount". Write a SQL query to find the total amount of revenue generated by each customer in the year 2022.
2. Suppose you have a table named "sales" with columns "product_id", "sale_date", and "sale_amount". Write a SQL query to find the top 5 products with the highest total sales in the month of December 2021.
3. Suppose you have a table named "employees" with columns "employee_id", "name", "start_date", and "department_id". Write a SQL query to find the employee with the longest tenure in each department.
4. Suppose you have a table named "transactions" with columns "transaction_id", "customer_id", "transaction_date", and "amount". Write a SQL query to find the customer with the highest total spend in the last 6 months, excluding any customers who have not made any transactions in the last 6 months.
5. Suppose you have a table named "stocks" with columns "stock_symbol", "stock_date", "stock_price". Write a SQL query to find the stocks that have had the greatest increase in price from the beginning of 2022 to the end of 2022.
Complete the following task based on the instruction and optional input provided.### Instruction:
Write 5 advance LeetCode questions for SQL.

### Output:
Sure, here are 5 advanced LeetCode questions for SQL:

1. Suppose you have a table named "orders" with columns "order_id", "customer_id", "order_date", and "amount". Write a SQL query to find the total amount of revenue generated by each customer in the year 2022.
2. Suppose you have a table named "sales" with columns "product_id", "sale_date", and "sale_amount". Write a SQL query to find the top 5 products with the highest total sales in the month of December 2021.
3. Suppose you have a table named "employees" with columns "employee_id", "name", "start_date", and "department_id". Write a SQL query to find the employee with the longest tenure in each department.
4. Suppose you have a table named "transactions" with columns "transaction_id", "customer_id", "transaction_date", and "amount". Write a SQL query to find the customer with the highest total spend in the last 6 months, excluding any customers who have not made any transactions in the last 6 months.
5. Suppose you have a table named "stocks" with columns "stock_symbol", "stock_date", "stock_price". Write a SQL query to find the stocks that have had the greatest increase in price from the beginning of 2022 to the end of 2022.