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....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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! |
| Sponsored Links |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| 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! |
| |||
| What is UNION,UNION ALL? UNION : eliminates duplicates UNION ALL: retains duplicates
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Both these are used to combine the results of different SELECT statements. Suppose I have five SQL SELECT statements connected by UNION/UNION ALL, how many times should I specify UNION to eliminate the duplicate rows? once.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is the restriction on using UNION in embedded SQL? It has to be in a CURSOR.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| In the WHERE clause what is BETWEEN and IN? BETWEEN supplies a range of values while IN supplies a list of values.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Is BETWEEN inclusive of the range values specified? Yes.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is 'LIKE' used for in WHERE clause? What are the wildcard characters? LIKE is used for partial string matches. '%' ( for a string of any character ) and '_' (for any single character ) are the two wild card characters.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| When do you use a LIKE statement? To do partial search e.g. to search employee by name, you need not specify the complete name; using LIKE, you can search for partial string matches.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is the meaning of underscore ( '_' ) in the LIKE statement? Match for any single character.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What do you accomplish by GROUP BY ... HAVING clause? GROUP BY partitions the selected rows on the distinct values of the column on which you group by. HAVING selects GROUPs which match the criteria specified.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project? SELECT EMPNO FROM EMP WHERE PROJECT IS NULL;
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/interview-questions-answers-tips/4218-sql-server-interview-questions-answers.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 03-13-2008 01:13 AM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SAP Interview Questions and Answers | S.Vinothkumar | Interview Questions & Answers and Tips | 88 | 03-26-2008 08:48 AM |
| CSS Interview Questions And Answers | Sabari | Interview Questions & Answers and Tips | 137 | 11-25-2007 09:38 PM |
| HR Interview Questions with Answers | Sabari | Interview Questions & Answers and Tips | 63 | 11-23-2007 06:13 AM |
| .Net Interview Questions & Answers | Venkat | Interview Questions & Answers and Tips | 100 | 11-13-2007 06:55 AM |
| SQL Server Interview Questions & Answers | Venkat | Interview Questions & Answers and Tips | 94 | 09-27-2007 08:42 AM |