SQL Query Interview Questions
HTML-код
- Опубликовано: 5 янв 2018
- Video talks about
SQL Query Interview Questions
SQL Interview Questions
SQL Interview Questions and answers
top sql questions
SQL real time scenario based interview questions
Top SQL Interview Questions and answers
Step by step SQL Training videos
SQL Tutorial
More videos at
/ @training2sqlmsbi
MSBI Opportunities/Jobs and Packages
Please watch and subscribe for more videos..
#SQLMSBI
• MSBI Opportunities and...
********************************
Top Procedure Interview questions in SQL Server?????
Please watch and subscribe for more videos.....
• SQL Procedure Intervie...
sample Code :
--A. Select highest salary from employee table
SELECT MAX(SAL) AS 'Max Salary' , MIN(Sal) AS 'Min Salary' FROM EMP
-- B. Get the employee details who has highest salary
SELECT * FROM EMP WHERE SAL=(SELECT MAX(SAL) FROM EMP)
-- C. Get the second highest salary from employee table
SELECT TOP 1 EMPName,SAL FROM (
SELECT TOP 2 EMPName,SAL FROM EMP ORDER BY SAL DESC) SUB ORDER BY SAL ASC
-- D. Get the employees list who has the salary between x and y.
SELECT * FROM EMP WHERE SAL Between 9000 and 13000
-- E. Get the highest salary on department wise
SELECT DeptName,MAX(SAL) AS 'MAX SAL' FROM EMP E JOIN DEPT D ON E.DeptNo=D.DeptNo GROUP BY DeptName
-- F. Get the highest salary, employee name along with department
SELECT E.EmpName,SUB.DeptName,SUB.[Max Sal] FROM EMP E JOIN
(
SELECT E.DeptNo, DeptName,MAX(SAL) AS 'Max Sal'
FROM EMP E JOIN DEPT D ON E.DeptNo=D.DeptNo GROUP BY DeptName,E.DeptNo) SUB
ON E.DeptNo=SUB.DeptNo AND E.Sal=SUB.[Max Sal] Наука
yes i want pivot and unpivot video plz make the video
Another way for last question is
select * from Employees e CROSS APPLY (select Department_Id,Max(Salary) as MaxSallery from Employees group by Department_Id) as d where e.Department_Id = d.Department_Id and e.Salary = d.MaxSallery;
yes.. might be several ways of achieving ...
thanks for letting me know..
My question like below.
To display employee name,years worked for and total salary for these years, assume salary to be constant in store procedure
Using adventure database.
Please help me how to solve this.
I have a table like
City1 city2
Delhi Goa
Mumbai Goa
Pune Delhi
Goa Pune
Goa Delhi
Delhi Pune.
In this, I don't want those rows in my output table where city1 to city2 is same as city2 to city1.
my final o/p will be :
City1 city2
Delhi Goa
Mumbai Goa
Pune Delhi
Goa Pune
give me a video of pivot and unpivot
Thanks for watching ..
Do you need pivot /unpivot in SQL server or SSIS ??
How split the data and display the output in different different columns.
For ex- Hina Bhatt is a name in name column we want to show Hina in a different column and Bhatt in different column
Use Substring & CharIndex functions
Hi instead of sub query why can't you to use rank,danse_rank
Plz show me another easier way to solve this last question .. I didn't get ur query very confusing
Very Basic SQL Query Interview Questions....Upload some tough questions...
Please check this video for some more questions...
ruclips.net/video/ZJ_hVb9zh00/видео.html
Training2SQL MSBI Thank you but I am looking for some more advanced query interview questions....
Alternative way for last question is
With maxDeptTable
AS
(select Department_Id,Max(Salary) as MaxSallery from Employees group by Department_Id
)
Select e.FirstName,e.LastName,e.Salary from Employees e Inner Join maxDeptTable on e.Department_Id = maxDeptTable.Department_Id where maxDeptTable.MaxSallery = e.Salary
I Want Sql Server Pivot And Unpivot o
Sure .. Keep watching videos...
Please increase the font size it is not visible
sure.. will try in the next video
Why do you use sub can you explained mor about it
Query is not properly visible