Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
Top 20 Linux and SQL Interview Questions for Java and IT Professionals
Top 10 Frequently asked SQL Query Interview Questions Answers
Difference between Correlated and Non-Correlated Subquery in SQL? Examples
Second Highest Salary in MySQL and SQL Server - LeetCode Solution
+----+--------+
| Id | Salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return NULL. You can write SQL query in any of your favorite databases e.g. MySQL, Microsoft SQL Server, or Oracle. You can also use database specific feature e.g. TOP, LIMIT or ROW_NUMBER to write SQL query, but you must also provide a generic solution which should work on all database.
Difference between ROW_NUMBER(), RANK() and DENSE_RANK() in SQL
Top 50 Microsoft SQL Server Interview Questions Answers for 1 to 3 Years Experienced
Difference between VARCHAR and CHAR data type in SQL Server? [Explained]
What is window function in SQL with Examples? How and when to use them?
What is Normalization in SQL? 1NF, 2nd NF, 3rd NF and BCNF Example Tutorial
What is temporary table in Database and SQL? Example Tutorial
Hello folks, if you have heard the term temporary table online or by your colleague in a call and wondering what is temporary table, what is the difference between a normal table and a temporary table, and when and how to use it then you have come to the right place. In this blog, we shall learn how to use a temporary table in SQL. But before we go into that we need an overview of SQL. What is SQL? SQL stands for Structured query language. it is a programming language used in communicating or relating to the relational database. And this programming language performs various forms of operation in the data. It was created in the 1970s, SQL is used by database administrators, and developers writing data integration scripts, etc.
Top 50 Database and SQL Interview Questions Answers for Programmers
7 Reasons of NOT using SELECT * in a Production SQL Query? Best Practices
Difference between ISNULL() and COALESCE() function in SQL? Example
Difference between table scan, index scan, and index seek in SQL Server Database? Example
How to find Nth Highest Salary in MySQL and SQL Server? Example LeetCode Solution
---------------------------------------------------------------
Write a SQL query to get the nth highest salary from the Employee table.
+----+--------+
| Id | Salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
For example, given the above Employee table, the nth highest salary where n = 2 is 200. If there is no nth highest salary, then the query should return null.