[go: up one dir, main page]

0% found this document useful (0 votes)
20 views2 pages

Interview

The document contains examples of SQL queries including selecting specific rows by number, filtering even and odd numbers, unions, top queries with ordering, identity inserts, row numbering, duplicates counts, ETL processes, blocking, indexes and error handling.

Uploaded by

prassin50
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Interview

The document contains examples of SQL queries including selecting specific rows by number, filtering even and odd numbers, unions, top queries with ordering, identity inserts, row numbering, duplicates counts, ETL processes, blocking, indexes and error handling.

Uploaded by

prassin50
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Select * from (
select ROW_NUMBER() over(order by salary) as SalaryRowno,* from TblsalaryMaster
)s where SalaryRowno =3

2.

3. select * from TblEmployeeMaster where empid%2=0 --Even Numbers

select * from TblEmployeeMaster where empid%2=1 -- Odd Numbers

4. Select 'C' as Text


union all
Select 'A'
union all
Select 'P'
union all
Select 'O'
union all
Select 'N'
union all
Select 'E'

5. Select top 1* from TblEmployeeMaster order by empid desc

6. set identity_insert [dbo].[TblDepartment] on

insert into [dbo].[TblDepartment](Deptid,DeptCode,DeptName,CreatedUser)


select 10,'ACC','Accounts',1

set identity_insert [dbo].[TblDepartment] off

7. Select * from (
select ROW_NUMBER() over(order by salary) as SalaryRowno,* from TblsalaryMaster
)s where SalaryRowno =5

8. select empid,count(*)DuplicateCount from [dbo].[TblEmpSalaryMaster]


Group by Empid having count(*)>1

9.ETL is used to Transfer data from one database to another.

10.

11.Blocking happens when multiple users access the same tables at a time.
Deadlock will totally block the database for further process.

12.

13.

14.Adding Indexes,Try to avoid sub querys,Removing unwanted joins.

15.This is mechanism for handing errors using try block and Catch block.

declare @Salary numeric(14,3),@monthsalary numeric(14,3)


Declare @Workays int
Set @Salary=10000
set @Workays=0

--set @monthsalary=@Salary/@Workays

begin try

select @Salary/@Workays

end try

begin catch

end catch

You might also like