Given two tables in a database, how would you fetch a field from the second table based on a related field in the first table? Provide an example using SQL JOIN.

Please sign-in to view the solution

Given a database with a table named 'Sales' containing columns 'SaleID', 'ProductID', 'Quantity', 'SaleDate', and 'Price', write an SQL query to find the total sales amount for each product in the year 2023. Additionally, rank these products based on the total sales amount in descending order and only display the top 5 products.

Please sign-in to view the solution

Given a table named 'Employees' with columns 'EmployeeID', 'ManagerID', 'Name', and 'Salary', write an SQL query to find each employee's salary as well as their manager's salary. Additionally, use a window function to rank employees based on their salaries within their respective departments.

Please sign-in to view the solution

Given a table named `Sales`

with columns `id`

, `employee_id`

, and `amount`

, and another table named `Employees`

with columns `id`

and `name`

, write a SQL query to rank employees based on their total sales amount. The result should include the employee name and their total sales amount, along with their rank.

### Input

`Sales`

table:

id | employee_id | amount |
---|---|---|

1 | 1 | 100 |

2 | 2 | 200 |

3 | 1 | 150 |

`Employees`

table:

id | name |
---|---|

1 | John |

2 | Jane |

Please sign-in to view the solution

Explain the different types of SQL joins, the order of SQL execution, and how you would perform SQL operations on a table to achieve a specific output. Provide examples.

Please sign-in to view the solution

Describe how you would handle several SQL query questions and explain how you would analyze a histogram and pie chart to present data insights.

Please sign-in to view the solution

Describe your understanding of SQL basic concepts such as Primary/Foreign Key, Joins, Union/Union All. Write SQL queries involving JOINs across 2-3 tables, Aggregation, Subqueries, Window functions, and CTEs (Leetcode- Easy and Medium). Explain statistical concepts and business metrics you have used in previous projects, KPIs you have built for analyzing data, strategies and tools to compare products, and how you would approach situation-based questions to improve efficiency and reduce query run time.

Please sign-in to view the solution

Explain how you would use advanced SQL techniques to identify consecutive numbers and segregate absent and present dates.

Please sign-in to view the solution

Two coding questions based on SQL. The first question involves using joins, and the second question involves ranking.

Please sign-in to view the solution

How do you join tables in SQL? Explain the types of joins and provide examples.

Please sign-in to view the solution

Given a table named `Salaries`

with columns `id`

, `employee_id`

, and `salary`

, and another table named `Employees`

with columns `id`

and `name`

, write a SQL query to find the employee with the highest salary. The result should contain the employee's name and their salary.

### Input

`Salaries`

table:

id | employee_id | salary |
---|---|---|

1 | 1 | 50000 |

2 | 2 | 70000 |

3 | 1 | 60000 |

`Employees`

table:

id | name |
---|---|

1 | John |

2 | Jane |

Please sign-in to view the solution

What is the difference between Tableau, Power BI, and other BI tools? Do you have any knowledge of Machine Learning?

Please sign-in to view the solution

Write a basic Python function to print a diamond of asterisks given an integer `n`

representing the number of rows in the upper half of the diamond (excluding the middle row).

**Input**
An integer `n`

.

**Example**
For `n = 3`

, the output should be:

```
*
***
*****
***
*
```

Please sign-in to view the solution

Describe how you would use Excel to perform tasks involving Pivot Tables, VLOOKUP, and Filters. Provide examples.

Please sign-in to view the solution

Written question: How would you forecast pricing for this particular model of TV based on this sales data from last year?

Please sign-in to view the solution

How would you put a cap on the number of items a seller is allowed to have on the Amazon marketplace? What would be the criteria for selecting which items stay on the marketplace if this limit was imposed and sellers were over the limit?

Please sign-in to view the solution

Explain the differences between linear regression and logistic regression. What are R-squared and P-value? Provide an example SQL query.

Please sign-in to view the solution

What kind of metrics do you want to monitor when you are taking charge of evaluating the business performance of an outbound warehouse?

Please sign-in to view the solution

What are ways to eliminate bottlenecks?

Please sign-in to view the solution