filmov
tv
🔎Find 2nd Highest Salary In SQL🔥TCS Interview Q & A
Показать описание
#sql #sqltips #sqlinterview #sqlinterviewquestions #infosys #removeduplicates #milestonecreator
Hey, Everyone welcome back. So, today in this video we will learn about
" How do I find the details about that employee who is getting the 2nd highest salary ????? "
🟢SQL QUERY USED FOR THIS VIDEO:-
---------------------------------------------------------------------------
CREATE DATABASE TEST;
USE TEST;
CREATE TABLE EMPLOYEE
(
ID Int,
FULL_NAME varchar(50),
SALARY Int
);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (1,'Deepan Kumar',50000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (2,'Niraj Patel',100000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (3,'Deepika Naik',70000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (4,'Ankita KumarI',90000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (5,'Shreya Naik',54000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (6,'Shyni Kedia',60000);
SELECT * FROM EMPLOYEE;
--FIND THE DETAIL ABOUT THAT EMPLOYEE WHO IS GETTING 2ND HIGEST SALARY ?????
SELECT * FROM EMPLOYEE;
SELECT ID,FULL_NAME,SALARY
FROM EMPLOYEE
WHERE SALARY =
(
SELECT MAX(SALARY) FROM EMPLOYEE
where salary (USE GRATER THEN SYMBOL)
(SELECT MAX(SALARY) FROM EMPLOYEE
WHERE SALARY (USE GRATER THEN SYMBOL)
(SELECT MAX(SALARY) FROM EMPLOYEE))
) ;
-----------------------------------------
👋 Additional resources
-------------------------------------------
2nd Highest Salary In SQL - TCS Interview Q & A:-
Infosys SQL Interview Question✅[ Remove Duplicate Records From Table📑In SQL ]:-
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-1 ] #sql
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-2 ] #sql
Introduction To SQL Server [ What is Database ]:-
What is DBMS || Database Management System [ In Hindi ]:-
What is RDBMS ( Relational Database Management System ):-
Database Recovery From MDF And LDF File Using GUI:-
2 Methods To Create LOGIN In SQL Server:-
How To Create a New Login/User In SQL Server:-
How To Delete/Drop LOGIN In SQL Server:-
Complete Guide For Import CSV File To #SqlServer Database (Step-By-Step Along With #ERROR & Solution;-
🔔 Subscribe to my YouTube channel:-
Social Media Link
--------------------------------
---------------------------------------------------------------------------------------------------------
Thanks for watching...
"Milestone Creator"
Hey, Everyone welcome back. So, today in this video we will learn about
" How do I find the details about that employee who is getting the 2nd highest salary ????? "
🟢SQL QUERY USED FOR THIS VIDEO:-
---------------------------------------------------------------------------
CREATE DATABASE TEST;
USE TEST;
CREATE TABLE EMPLOYEE
(
ID Int,
FULL_NAME varchar(50),
SALARY Int
);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (1,'Deepan Kumar',50000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (2,'Niraj Patel',100000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (3,'Deepika Naik',70000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (4,'Ankita KumarI',90000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (5,'Shreya Naik',54000);
INSERT INTO EMPLOYEE (ID,FULL_NAME,SALARY) VALUES (6,'Shyni Kedia',60000);
SELECT * FROM EMPLOYEE;
--FIND THE DETAIL ABOUT THAT EMPLOYEE WHO IS GETTING 2ND HIGEST SALARY ?????
SELECT * FROM EMPLOYEE;
SELECT ID,FULL_NAME,SALARY
FROM EMPLOYEE
WHERE SALARY =
(
SELECT MAX(SALARY) FROM EMPLOYEE
where salary (USE GRATER THEN SYMBOL)
(SELECT MAX(SALARY) FROM EMPLOYEE
WHERE SALARY (USE GRATER THEN SYMBOL)
(SELECT MAX(SALARY) FROM EMPLOYEE))
) ;
-----------------------------------------
👋 Additional resources
-------------------------------------------
2nd Highest Salary In SQL - TCS Interview Q & A:-
Infosys SQL Interview Question✅[ Remove Duplicate Records From Table📑In SQL ]:-
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-1 ] #sql
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-2 ] #sql
Introduction To SQL Server [ What is Database ]:-
What is DBMS || Database Management System [ In Hindi ]:-
What is RDBMS ( Relational Database Management System ):-
Database Recovery From MDF And LDF File Using GUI:-
2 Methods To Create LOGIN In SQL Server:-
How To Create a New Login/User In SQL Server:-
How To Delete/Drop LOGIN In SQL Server:-
Complete Guide For Import CSV File To #SqlServer Database (Step-By-Step Along With #ERROR & Solution;-
🔔 Subscribe to my YouTube channel:-
Social Media Link
--------------------------------
---------------------------------------------------------------------------------------------------------
Thanks for watching...
"Milestone Creator"