crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Top 13 SQL Query ask in Interview Year 2019
Question Posted on 09 Mar 2019Home >> DataBase >> SQL Query >> Top 13 SQL Query ask in Interview Year 2019

Top 13 SQL Query ask in Interview Year 2019
Below are the list of query ask these days in interview

(1)What is the Output of below query
select * from table_name where 1=1
Output :- This will returns all the data from table table_name

(2)What is the Output of below query
select * from table_name where 1=2
Output:- This will return no data but only the column name from the table

(3)What is the output of below query
select * from table_name where x=y
Output:-This will retun error if there is no column name x and y in the table but if we have these two column in it then it will return the data if coloumn x and y are equal

(4)Write a sql query which will fetch ProjectWise count of employees
select Project,count(EmployeeId) from table_project Group by Project Order by Id Desc
we need to use Group By becasue there is a aggregate function in above query

(5)Query to get only the first from from FullName coloumn
select Project,count(EmployeeId) from table_project Group by Project Order by Id Desc

(6)Write a query to fetch only odd rows from table
SELECT A.EmpId, A.Project, A.Salary
FROM (
SELECT *, Row_Number() OVER(ORDER BY EmpId) AS RowNumber
FROM EmployeeSalary
) A
WHERE A.RowNumber % 2 = 1


(7)Write a query to fetch only Even rows

SELECT A.EmpId, A.Project, A.Salary
FROM (
SELECT *, Row_Number() OVER(ORDER BY EmpId) AS RowNumber
FROM EmployeeSalary
) A
WHERE A.RowNumber % 2 = 0


(8)Create a table same as other table with same structure and all data

Select * into tablename from table_name1;


(9)Create a empty table with same structure as some other table

Select * into tablename from table_name1 where 1=0;


(10)Write a query to fetch common record from two table

Select * from table_name1
Intersect
Select * from table_name2


(11)Write a query to fetch records that present in one table but not in another table.

Select * from table_name1
MINUS
Select * from table_name2



(12)Write a Sql query to fetch the data for particular year

Select * from table_name1 where Year(dateofjoining)='2019';


(13)Get data from table at 7th,8th,9th place from table

SELECT TOP 1 Salary
FROM (
SELECT DISTINCT TOP N Salary
FROM Employee
ORDER BY Salary DESC
)
ORDER BY Salary ASC
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

How to get the table count in last used query from cache by sending tablename?

Write a SQL query to print 1 to 100 in sql server?

Sql Interview Latest Query questions asked on 30 dec 2020

nth highest number from table

some good sql query






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap