Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JAVASCRIPT
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 :) Latest Articles
 


  

 
Top 13 SQL Query ask in Interview Year 2019
Classified Posted on 09 Mar 2019

Home >> 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







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |