Home » Interview Q&A » Archive by categorySQL Interview Questions (Page 3)

default constraint in sql

Hey folks till now we have discussed User defined functions in sql, Kill Processes in sql server 2008, View in sql ,Remove Cross duplicate rows in SQL, Recursive SQL Query , Recursive SQL Query-2, STUFF and CONCAT in SQL, RANK in SQL server , Difference between temporary table and table variable in sql server, UNIQUEIDENTIFIER in SQL Server, RAW Mode with...
Continue reading

Recursive SQL Query-2

Recursive SQL Query-2  Lets say I have a table which contains list of Employees of company, which is as shown below: Now if I want all employees’ who are working on 3rd level of hierarchy  like shown as below: I have written below code by Using CTE. I have added Level...
Continue reading

Recursive SQL Query

Recursive SQL Query Lets say I have a table which contains list of Employees of company, which is as shown below: Now if I want all employees’ who are reporting to John like shown as below: I have written below code by Using CTE. I have added e.MANAGER_ID=3....
Continue reading

SQL Query to get desire output-4

SQL Query to get desire output-4 Lets say we have tow tables named with Employee and Department shown as below: Now if we want Total salary and Average salary of Department wise shown as below: For that we have to write query as below: [crayon-5c47f57d6af40999959885/]  
Continue reading

pivot and unpivot in sql server

I have already explained you regarding RANK(), DENSE_RANK(), ROW_NUMBER() , Aggregate functions in sql server and Identity column in sql server. Today I am going to explain regarding pivot and unpivot in Sql Server. Pivot is used to change the table tabular form. This means that you can change the output of the...
Continue reading

How to write SQL Query to get desire output-3

Hello friends, i got one interesting query from some source which i thought to share with you. I want output as follows, how can you write query for that ! We have two tables as bellow:   OUTPUT:- I want total as per credit and debit value from...
Continue reading

Difference between a primary key and a unique key

Both primary key and unique enforce uniqueness of the column on which they are defined. But, there are some differences as well which are as below: Primary Key Unique Key  Creates a clustered index on the column  Creates a nonclustered index  Doesn’t allow NULL  Allows one NULL only,but the...
Continue reading

Difference between delete and truncate in sql server

Difference between delete and truncate in sql server : Truncate and Delete both are used to delete data from the table. Please go over through the below difference in DELETE and TRUNCATE. DELETE TRUNCATE The DELETE command is used to remove rows from a table TRUNCATE removes all...
Continue reading

OUTPUT Clause in SQL Server

OUTPUT Clause in sql server
Hello friends, We have already explain regarding IIF() in SQL Server,Right Join in SQL Server,left join in SQL, Self Join in SQL Server , RANK(), DENSE_RANK(), ROW_NUMBER(), Aggregate functions in sql server and Create XML in sql server. Today i will explain OUTPUT Clause in SQL Server. As...
Continue reading

PATH Mode with FOR XML

PATH Mode with FOR XML
Hello friends, We have already explain regarding IIF() in SQL Server,Right Join in SQL Server,left join in SQL, Self Join in SQL Server , RANK(),  DENSE_RANK(), ROW_NUMBER() and  Aggregate functions in sql server. Today I am going to explain regarding Create XML in SQL Server, however this is my first step toward writing post....
Continue reading




DISCLAIMER:
The content is copyrighted to technothirsty.com and may not be reproduced on other websites without permission from the owner.You may contact us using the information below.