SQL Server Interview Questions For 2-5 Years Experienced

Q1). In what sequence SQL statement are processed?
Ans. The clauses of the select are processed in the following sequence
FROM clause
WHERE clause
GROUP BY clause
HAVING clause
SELECT clause
ORDER BY clause
TOP clause
Q2). Can we write a distributed query and get some data which is located on other server and on Oracle Database ?
Ans. SQL Server can be lined to any server provided it has OLE-DB provider from Microsoft to allow a link.
E.g. Oracle has a OLE-DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.
Q3). If we drop a table, does it also drop related objects like constraints, indexes, columns, defaults, Views and Stored Procedures ?
Ans. YES, SQL Server drops all related objects, which exists inside a table like, constraints, indexes, columns, defaults etc. BUT dropping a table will not drop Views and Stored Procedures as they exists outside the table.
How would you determine the time zone under which a database was operating?
Q4). Can we add identity column to decimal datatype?
Ans. YES, SQL Server support this
Q5). What is the Difference between LEFT JOIN with WHERE clause & LEFT JOIN with no WHERE clause ?
Ans. OUTER LEFT/RIGHT JOIN with WHERE clause can act like an INNER JOIN if not used wisely or logically.
Q6). What are the Multiple ways to execute a dynamic query ?
Ans. EXEC sp_executesql, EXECUTE()
Q7). What is the Difference between COALESCE() & ISNULL() ?
Ans. ISNULL accepts only 2 parameters. The first parameter is checked for NULL value, if it is NULL then the second parameter is returned, otherwise it returns first parameter.
COALESCE accepts two or more parameters. One can apply 2 or as many parameters, but it returns only the first non NULL parameter,
Q8). How do you generate file output from SQL?
Ans. While using SQL Server Management Studio or Query Analyzer, we have an option in Menu BAR.QUERTY >> RESULT TO >> Result to FILE
Q9). How do you prevent SQL Server from giving you informational messages during and after a SQL statement execution?
Ans. Pattern matching operator is LIKE and it has to used with two attributes% means matches zero or more characters an_ ( underscore ) means matching exactly one character

Author: admin

Leave a Reply