SQL stored procedures interview questions and answers

SQL stored procedures interview questions and answers for freshers and experienced candidates. These interview questions and answers on SQL stored procedures will help you strengthen your technical skills, prepare for the interviews and quickly revise the concepts. Many candidates appear for the interview for one role - many of the them give the right answers to the questions asked. The one who provides the best answer with a perfect presentation is the one who wins the interview race. The set of SQL stored procedures interview questions here ensures that you offer a perfect answer to the interview questions posed to you.
          

SQL Server stored procedures interview questions

 

<<Previous  Next>>

Define Stored Procedures.
Define extended Stored Procedures.
What are the purposes and advantages stored procedure?
Determine when to use stored procedure to complete SQL Server tasks.

Test your SQL Server Skills!

Sql server part 1 (40 questions)  
Sql server part 2 (28 questions)
ASP.NET (41 questions)
Database concepts (20 questions) 

SQL Server stored procedure - August 29, 2008 at 18:00 PM by Nishant Kumar

Define Stored Procedures.

A stored procedure is a compiled set of Transact-SQL statements.
The business logic can be encapsulated using stored procedure.
It improves network traffic by running set of Transact-SQL statements at one go.

Define extended Stored Procedures.

An extended stored procedure compiles as DLL and are created to expand capabilties of user defined stored procedure. It uses xp_ prefix as naming convention.


SQL Server Stored procedure - Nov 20, 2008 at 18:00 PM by Rajmeet Ghai

Define stored procedure.

Answer
Stored procedure is a set of SQL commands that have been complied and stored on the database sever. They can be used in the code as and when required since hey stored. They need not be complied over and over again. They can be invoked by CALL procedure (..) or EXECUTE procedure(..)

What are the purposes and advantages stored procedure?

Answer
Purposes and advantages of stored procedures:

  • Manage, control and validate data
  • It can also be used for access mechanisms
  • Large queries can be avoided
  • Reduces network traffic since they need not be recompiled
  • Even though the stored procedure itself may be a complex piece of code, we need not write it over and over again. Hence stored procedures increases reusability of code
  • Permissions can be granted for stored procedures. Hence, increases security.

Determine when to use stored procedure to complete SQL Server tasks.

Answer

  • If a large piece of code needs to be performed repeatedly, stored procedures are ideal
  • When hundreds of lines of SQL code need to be sent; it is better to use stored procedure through a single statement that executes the code in a procedure, rather than by sending hundreds of lines of code over the network.
  • When security is required.


<<Previous  Next>>

Also read

Describe in brief exporting and importing utility?

Answer - The Bulk Copy is a command utility that transfer SQL data to or from a data file.
This utility mostly used to transfer huge data to SQL server from other database....

Define Distributed Query and Linked Server?

Answer - Distributed Query is a query which can retrieve data from multiple data sources including distributed data........

Define temporary and extended stored procedure.

Answer - Temporary Stored Procedure is stored in TempDB database. It is volatile and is deleted once connection gets terminated or server is restarted......

Define Primary and Unique key.

Answer - The column or columns of the table whose value uniquely identifies each row in the table is called primary key. You can define column as primary key using primary key constraint while you create table.....

What is index? Define its types.

Answer - Index can be thought as index of the book that is used for fast retrieval of information. Index uses one or more column index keys and pointers to the record to locate record.........

 

The answers to following questions will be made available soon. Keep visiting.

Define Stored procedure.
What are the purposes and advantages stored procedure?
Determine when to use stored procedure to complete SQL Server tasks.
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure.
Explain nested stored procedure. Syntax and an example for create nested stored procedure.
What security features are available for stored procedure?
In what three ways is the RETURN statement used in a stored procedure.



Write your comment - Share Knowledge and Experience

Discussion Board
Awesome post.. All question at one place

Awesome post.. All question at one place

Mekala Arumugam 06-7-2018 06:30 AM

SQL Server interview

Good SQL Server questions, very helpful.

Thanks

SQL Server 03-8-2018 04:18 AM

interview

Thanks for uploading and it is very useful for interview thanks a lot

Mahesh 08-10-2016 05:25 AM

perfect questions

the questions are so perfect, nice article than you guys!!

Raj 01-23-2016 10:27 PM

SQL developer interview questions

Thanks for providing the above questions. Here are some more interview questions..

Q1. Explain Collation?
Ans. It is a set of rules that is used to determine that how character data can be compared and sorted.

Q2. What is cluster Index?
Ans. It is used for easy retrieval of data from the database by altering the way that the records are stored. Database sorts out rows by the column which is set to be clustered index.

Q3. What is the use of TRUNCATE Command?
Ans. TRUNCATE command also deletes the data but delete all the rows which is specified in the table. With full explanation https://intellipaat.com/interview-question/sql-developer-interview-questions/

Q4. What are the types of subquery?
Ans. There are two types of subquery i.e.
1. Correlated subquery
2. Non correlated subquery

Q5. Explain primary key?
Ans. It is combination of fields which uniquely specify a row and it have no NULL value.


softinx 09-26-2015 02:55 AM

SQL Server interview questions and answers

What is Lock Escalation?
Lock escalation is the process of reducing the overhead of the system by converting many fine grain locks into fewer coarse grain locks. Lock escalation threshold is determined dynamically by SQL server. It doesn’t require any configuration hassles as SQL Server choose to keep lock on both row and column for the page query.

What is RAID and what are different types of RAID levels?
RAID stands for Redundant array of independent disks which was earlier called as Redundant array of inexpensive disks. It is a storage technology that has one logical unit consisting of multiple disk drive components. It increases the performance by replicating and dividing the data through many levels between multiple physical drives. There are 12 Raid Levels which are as follows:
- Level 0: it is a 'striped' disk array (provides data stripping) without fault tolerance.
- Level 1: It is used in system for “mirroring” and “duplexing” purpose.
- Level 2: in this error correction takes place
- Level 3: it provides byte level stripping also called as “bit-interleaved parity”
- Level 4: is used as “dedicated parity drive” and it provides block level striping
- Level 5: is “block interleaved distributed parity”
- Level 6: is “independent data disks with double parity.
- Level 0+1: is “a mirror of stripes” and used for replication and sharing of data among disks
- Level 10: is “a stripe of mirrors”. Multiple mirrors are created and then stripes over it.
- Level 7: It adds caching to Level 3 or 4.
- Level 50: implemented as striped array with fault tolerance
- RAID S: it is proprietary striped parity RAID system


Rohit Sharma 12-7-2011 07:06 AM

SQL Server interview questions and answers

What's the difference between a primary key and a unique key?
- Primary key is a combination of columns which uniquely specify a row whereas a unique key is related to the superkey and can uniquely identify each row in the table.
- Primary can only be one in each table as it is one of the special cases of the unique key whereas a unique key can be many.
- Primary key enforces the NOT NULL constraint whereas unique key doesn’t. Due to this values in the unique key columns may or may not be NULL.

What is bit data type and what's the information that can be stored inside a bit column?
- Bit data type is the smallest type used in a language. It is used to store the boolean information of the form 1 (true) or 0 (false). The former versions of SQL server doesn’t support NULL type in this but recent version such as SQL server 7.0 onwards it supports NULL state as well.

Define candidate key, alternate key, and composite key.
- Candidate Key is a key which provides the uniqueness of the column(s). It identifies each row of a table as unique. It can become the primary key of the table as well. Every tabular relationship will have atleast one candidate key.
- Alternate Key is a type of candidate key which is formed when there are more than one candidate key and one of them is a primary key then other keys will act as an alternate keys. Unique keys also termed as alternate keys which prevent incorrect data from entering the table.
- Composite Key is a special type of candidate key as it is formed by combining two or more columns. This gives assurance of uniqueness of data when the columns are joined together.

What are ACID properties?
ACID is used in database and it includes the following properties such as atomicity, consistency, isolation and durability. These properties allow easy, reliable and secure database transaction. Example: Transfer of money from one bank account to another. It is used to manage the concurrency in the database table.

What is the difference between Locking and multi-versioning?
Locking is a means of not allowing any other transaction to take place when one is already in progress. In this the data is locked and there won’t be any modification taking place till the transaction either gets successful or it fails. The lock has to be put up before the processing of the data whereas
Multi-versioning is an alternate to locking to control the concurrency. It provides easy way to view and modify the data. It allows two users to view and read the data till the transaction is in progress.



Rohit Sharma 12-7-2011 07:06 AM

SQL Server interview questions and answers

What's the difference between a primary key and a unique key?
- Primary key is a combination of columns which uniquely specify a row whereas a unique key is related to the superkey and can uniquely identify each row in the table.
- Primary can only be one in each table as it is one of the special cases of the unique key whereas a unique key can be many.
- Primary key enforces the NOT NULL constraint whereas unique key doesn’t. Due to this values in the unique key columns may or may not be NULL.

What is bit data type and what's the information that can be stored inside a bit column?
- Bit data type is the smallest type used in a language. It is used to store the boolean information of the form 1 (true) or 0 (false). The former versions of SQL server doesn’t support NULL type in this but recent version such as SQL server 7.0 onwards it supports NULL state as well.



Rohit Sharma 12-7-2011 07:05 AM

SQL Server interview questions and answers

What is normalization? Explain different forms of normalization?

Normalization is a process of organizing the data to minimize the redundancy in the relational database management system (RDBMS). The use of normalization in database is to decompose the relations with anomalies to produce well structured and smaller relations. There are 6 forms of normalization which are as follows:-
- 1NF represents a relation with no repeating groups
- 2NF represents no non-prime attribute in the table
- 3NF defines that every non-prime attribute is non-transitively dependent on every candidate key
- 4NF defines that every non-trival multi-valued dependency in table is dependent on superkey.
- 5NF defines that every non-trival join dependency in table is implied by superkey in table.
- 6NF defines that a table features no non-trival join dependency.

What is de-normalization and what are some of the examples of it?
De-normalization is used to optimize the readability and performance of the database by adding redundant data. It covers the inefficiencies in the relational database software. De-normalization logical data design tend to improve the query responses by creating rules in the database which are called as constraints.
Examples include the following:
- Materialized views for implementation purpose such as:
- Storing the count of “many” objects in one-to-many relationship
- Linking attribute of one relation with other relations
- To improve the performance and scalability of web applications


Rohit Sharma 12-7-2011 07:04 AM

SQL Server interview questions

What are the different index configurations a table can have?

No indexes
A clustered index
A clustered index and many nonclustered indexes
A nonclustered index
Many nonclustered indexes


What is BCP?

It is used to copy huge amount of data from tables and views.
It does not copy the structures same as source to destination.

Dheeraj 12-6-2011 01:38 AM

 


 



 
Interview questions
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring