SQL Interview Question And Answer | SQL Interview Question And Answer for Fresher | SQL Server | Set 09

1.What is the difference between a Local and a Global temporary table?
 Ans: A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.
         A global temporary table remains in the database permanently, but the rows exist only within a given connection. When connection is closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

2.How to get @@ERROR and @@ROWCOUNT at the same time?
 Ans: If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset. And if @@Recordcount is checked before the error-checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable.
     SELECT @RC = @@ROWCOUNT, @ER = @@ERROR

3.What are the advantages of using Stored Procedures?
 Ans: 1.Stored procedure can reduced network traffic and latency, boosting application performance.
         2.Stored procedure execution plans can be reused, staying cached in SQL Server's memory, reducing server overhead.
         3.Stored procedures help promote code reuse.
         4.Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.
         5.Stored procedures provide better security to your data.

4.Can SQL Servers linked to other servers like Oracle?

 Ans: SQL Server can be linked to any server provided it has OLE-DB provider from Microsoft to allow a link. E.g. Oracle has an OLE-DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.

5.What is the UNION?
 Ans: UNION is the bassically a type of a command which is used for the selection procedure, It is select the related information from the two tables, similarily JOIN command. when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.

6.What is the RANK() OVER?

 Ans: It is bassically Return the value as a rank of each row within the partition of a result set.

7.What is the mean of ROW_NUMBER() OVER?
 Ans: It s the sequential no of the row with in the partition pf the resultset,starting at 1 for the First row in each partition. 

8.What is the Ranking functions?
 Ans: Ranking Function is the bassically use for the return value which is the ranking of the each row in the partion. These ranking functins are non Deterministic. there are many diff type of ranking functions :
         1.ROW_NUMBER() OVER([<Partion_By_Clause>]<Order_By_Clause>)
         2.RANK() OVER([<Partion_By_Clause>]<Order_By_Clause>)
         3.DENSE_RANK() OVER([<Partion_By_Clause>]<Order_By_Clause>)

9.What is the ROW_NUMBER()?
 Ans: Row Function is bassically use for the retuning a coulumns which is type of expressions. which is contain the rows no with in the result set.This is only a number used in the context of the result set, if the result changes, the ROW_NUMBER() will change

10.What is an Aggregate Function?

 Ans: Aggregation Function is basically a type of function, which is use for the calculation on the set of values and It is also return the single value , Its also have a HAVING CLAUSE, Which is used along with GROUP BY.for filtering query using aggregate values, Its ignore NULL Values excpt COUNT Function, Its have a many functions which is there :

        1. AVG
        2. MIN
        3. CHECKSUM_AGG
        4. SUM
        5. COUNT
        6. STDEV
        7. COUNT_BIG
        8. STDEVP
        9. GROUPING
        10. VAR
        11. MAX
        12. VARP
Previous Next


:: Click the links below for similar type Questions and answers ::

>

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes