IT Community - Software Programming, Web Development and Technical Support

SQL Server Interview Questions and Answers

This is a discussion on SQL Server Interview Questions and Answers within the Interview Questions & Answers and Tips forums, part of the DiscussWeb IT Curriculum category; Let we start some interview questions with answers for sql server here....


Go Back   IT Community - Software Programming, Web Development and Technical Support > DiscussWeb IT Curriculum > Interview Questions & Answers and Tips

Register FAQ Members List Calendar Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 10-29-2007, 06:57 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Cool SQL Server Interview Questions and Answers

Let we start some interview questions with answers for sql server here.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 10-29-2007, 06:59 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Smile Re: SQL Server Interview Questions and Answers

How would you find out the total number of rows in a table? Use

SELECT COUNT(*) ... in query
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 10-29-2007, 07:00 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Cool Re: SQL Server Interview Questions and Answers

How do you eliminate duplicate values in SELECT ?

Use SELECT DISTINCT ... in query
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 10-29-2007, 07:01 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Smile Re: SQL Server Interview Questions and Answers

How do you find the maximum value in a column in db?

Use SELECT MAX(...) .. in db query
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 10-29-2007, 07:02 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Cool Re: SQL Server Interview Questions and Answers

How do you retrieve the first 5 characters of FIRSTNAME column of DB2 table EMP ?

SQL Query : SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 10-29-2007, 07:04 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Smile Re: SQL Server Interview Questions and Answers

What are aggregate functions?

Bulit-in mathematical functions for use in SELECT clause.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 10-29-2007, 07:06 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Default Re: SQL Server Interview Questions and Answers

Can you use MAX on a CHAR column?

YES.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 10-29-2007, 07:09 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Cool Re: SQL Server Interview Questions and Answers

My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results. Why?

Because SALARY is not declared to have NULLs and the employees for whom the salary is not known are also counted.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 10-29-2007, 07:10 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Cool Re: SQL Server Interview Questions and Answers

How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name?

SELECT FIRSTNAME || ' ' || LASTNAME FROM EMP;
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 10-29-2007, 07:10 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 904
S.Vinothkumar is on a distinguished road
Wink Re: SQL Server Interview Questions and Answers

What is the use of VALUE function?

1. Avoid -ve SQLCODEs by handling nulls and zeroes in computations
2. Substitute a numeric value for any nulls used in computation
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SAP Interview Questions and Answers S.Vinothkumar Interview Questions & Answers and Tips 89 07-09-2010 06:02 PM
Jsp interview Questions And Answers leoraja8 Java Server Pages (JSP) 23 12-23-2007 08:19 PM
CSS Interview Questions And Answers Sabari Interview Questions & Answers and Tips 137 11-25-2007 08:38 PM
.Net Interview Questions & Answers Venkat Interview Questions & Answers and Tips 100 11-13-2007 05:55 AM
SQL Server Interview Questions & Answers Venkat Interview Questions & Answers and Tips 94 09-27-2007 07:42 AM


All times are GMT -7. The time now is 12:27 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
Stamford Dentist | Euro Millions Lottery | Tech Support Services

SEO by vBSEO 3.0.0