Publog Developer Blog of Shivishbrahma

Posts tagged with #sql

Snowflake SQL Cheatsheet

SQL Essentials Joins Join Type Description Syntax INNER Returns rows that match on both sides of the join SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column LEFT Returns all rows from the left table, and the matched rows from the right table SELECT * FROM table1 LEFT...

Top SQL Interview Questions

Write an SQL query to fetch the second-highest salary from an employees table. SELECT MAX(salary) AS SecondHighestSalary FROM employees WHERE salary < (SELECT MAX(salary) FROM employees); SELECT salary AS SecondHighestSalary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1; SELECT salary AS SecondHighestSalary FROM ( SELECT salary, row_number() OVER...