Monday, February 27, 2012

HCL Interview faced questions

1.create table emp(empid int,empname varchar(20));
create table dept(empid int,deptid int,deptname varchar(20));

insert into emp
select 1,'ravi'
union all
select 2,'chandra'
union all
select 3,'dama';

insert into dept
select 1,1,'IT'
union all
select 2,2,'Sales'
union all
select null,2,'Sales';

select * from emp where empid  not in (select empid from dept)



Question: What is the output?

I told wrong answer....

Original answer: empid   empname  (no rows are retrieving)

2.Write a query Highest 9th salary employee  from employee table (with out use top and max keywords)

3. Difference between len and datalength? and give me syntax?


4. What page and Extent in sql server 2008?

5 Write triggers 

   We have 2 tables
table 1: customerBalance (CustomerId intger,CurrentBalance numeric(22,2))
table 2. CustomerAuditBalance(AuditId intger identity(1,1),CustomerId integer,Old_Balance numeric(22,2),New_Balance(22,2),Createddate datetime default getdate())

Write triggers
Q1)Dont allow negative balance of customer withdraw time?
Q2) All success withdraw transactions need to insert in audit table?






 

No comments:

Post a Comment