Posts

Find all employees who have or had a job title that includes manager. Output the first name along with the corresponding title.

You have been asked to find the fifth highest salary without using TOP or LIMIT. Note: Duplicate salaries should not be removed.

You are given a table of tennis players and their matches that they could either win (W) or lose (L). Find the longest streak of wins. A streak is a set of consecutive won matches of one player. The streak ends once a player loses their next match. Output the ID of the player or players and the length of the streak.

Demystifying SQL: A Beginner's Guide to Database Management

Find the ratio / mix of students by gender in each class

How to calculate tenure of employee via SQL

1. WHERE, AND, OR, NOT, IN 2. ORDER BY, ASC, DESC 3. IS NULL 4. LIMIT 5. MIN, MAX, COUNT, AVG, SUM 6. LIKE, WILDCARDS 7. IN BETWEEN 8. JOINs - INNER, LEFT, RIGHT, FULL 9. Subqueries & CTEs 10. UNION 11. GROUP BY 12. HAVING 13. PARTITION BY, OVER 14. LEAD, LAG 15. RANK, DENSE_RANK, PERCENT_RANK 16. ROW_NUMBER, CUME_DIST 17. FIRST_VALUE, LAST_VALUE

Write a sql query to find the second largest number from table table_name and column number.

SQL What is the correct order of execution ?

WRITE A QUERY TO OUTPUT THE APARTMENTS WHOSE PRICES ARE GREATER THAN THE AVERAGE AND ARE ALSO NOT RENTED ,SORTED BY PRICE COLUMN

what is null ? unknown or missing values-- null is not equal to zero or blank

-- If experience and Salary is stored as monthly, if they are stored yearly basis then you can add the Logic to get the monthly salary and experience in monthSELECT Name, Experience, SalaryFROM tblEmployeeWHERE Experience > 10 AND Salary > 15000;SELECT * FROM tblEmployeeWHERE Name LIKE '[^aeiouAEIOU]%[aeiouAEIOU]';

3. Find the employees who are working in more than 2 departments. Print their employee number, first name, last_name and the number of departments they work in. SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME,COUNT(DEPARTMENT_ID) FROM employeesHAVING COUNT(DEPARTMENT_ID) > 2Group by 1,2,3

2. Find the minimum, maximum and average salary of each employee title and order the results by ascending order of maximum salary SELECT J.JOB _TITLE,J.MIN _SALARY,J.MAX_SALARY,AVG(E.SALARY) FROM jobs JFULL OUTER JOIN employees E on J.JOB_ID = E.JOB_IDORDER BY J.MAX_SALARY

scoring system

write queries for following scieniores max users visited date ,user with maximum transitions date,user visited but not done any transition.