Q1. What is the next number in the sequence 2, 5, 10, 17, 26, __?
Q2. If the price of a shirt is reduced by 20%, and then reduced by an additional 10%, what is the final price as a percentage of the original price?
Q3. If 3 people can paint a house in 4 days, how many people are needed to paint the same house in 2 days?
Q4. Write a Python program that uses the reduce function to find the product of a list of integers entered by the user.
Q5. Suppose you have a database table named orders that contains information about customer orders, including the customer name, product name, and order date. Write a MySQL query to create a view named monthly_orders that displays the total number of orders for each month and year.
The orders table has the following columns:
order_id (int)
customer_name (varchar)
product_name (varchar)
order_date (date)
Your view should have the following columns:
year (int)
month (int)
total_orders (int)
Your query should group the orders by month and year, and calculate the total number of orders for each group. The year and month columns should be extracted from the order_date column.
Here’s an example output of the monthly_orders view:
year | month | total_orders |
---|---|---|
2022 | 1 | 10 |
2022 | 2 | 12 |
2022 | 3 | 15 |
2022 | 4 | 8 |
2022 | 5 | 9 |