SQL Interview Questions
1. What are the two authentication modes in SQL Server?
There are two authentication modes –
- Windows Mode
- Mixed Mode
Modes can be changed by selecting the tools menu of SQL Server configuration properties and choose security page.
2. What Is SQL Profiler?
SQL Profiler is a tool which allows system administrator to monitor events in the SQL server. This is mainly used to capture and save data about each event of a file or a table for analysis. know more at SQL server dba online training
3. What is recursive stored procedure?
SQL Server supports recursive stored procedure which calls by itself. Recursive stored procedure can be defined as a method of problem solving wherein the solution is arrived repetitively. It can nest up to 32 levels.
4. What are the differences between local and global temporary tables?
- Local temporary tables are visible when there is a connection, and are deleted when the connection is closed.
- 5. What is CHECK constraint?
- A CHECK constraint can be applied to a column in a table to limit the values that can be placed in a column. Check constraint is to enforce integrity.
6. Can SQL servers linked to other servers?
SQL server can be connected to any database which has OLE-DB provider to give a link. Example: Oracle has OLE-DB provider which has link to connect with the SQL server group.
7. What is sub query and its properties?
A sub-query is a query which can be nested inside a main query like Select, Update, Insert or Delete statements. This can be used when expression is allowed. Properties of sub query can be defined as
- A sub query should not have order by clause
- A sub query should be placed in the right hand side of the comparison operator of the main query
- A sub query should be enclosed in parenthesis because it needs to be executed first before the main query
- More than one sub query can be included
8. What are the types of sub query?
There are three types of sub query –
- Single row sub query which returns only one row
- Multiple row sub query which returns multiple rows
- Multiple column sub query which returns multiple columns to the main query. With that sub query result, Main query will be executed.
9. What is SQL server agent?
The SQL Server agent plays a vital role in day to day tasks of SQL server administrator(DBA). Server agent’s purpose is to implement the tasks easily with the scheduler engine which allows our jobs to run at scheduled date and time. know more at Sql server dba training
10. What are scheduled tasks in SQL Server?
Scheduled tasks or jobs are used to automate processes that can be run on a scheduled time at a regular interval. This scheduling of tasks helps to reduce human intervention during night time and feed can be done at a particular time. User can also order the tasks in which it has to be generated.
11. What is COALESCE in SQL Server?
COALESCE is used to return first non-null expression within the arguments. This function is used to return a non-null from more than one column in the arguments.
12. How exceptions can be handled in SQL Server Programming?
Exceptions are handled using TRY — — CATCH constructs and it is handles by writing scripts inside the TRY block and error handling in the CATCH block.
13. Can we check locks in database? If so, how can we do this lock check?
Yes, we can check locks in the database. It can be achieved by using in-built stored procedure called sp_lock.
14. What is the use of SIGN function?
SIGN function is used to determine whether the number specified is Positive, Negative and Zero. This will return +1,-1 or 0.
15. What is the purpose of FLOOR function?
FLOOR function is used to round up a non-integer value to the previous least integer. Example is given
16. What is a Trigger?
Triggers are used to execute a batch of SQL code when insert or update or delete commands are executed against a table. Triggers are automatically triggered or executed when the data is modified. It can be executed automatically on insert, delete and update operations.
17. What are the types of Triggers?
There are four types of triggers and they are:
- Instead of
18. What is an IDENTITY column in insert statements?
IDENTITY column is used in table columns to make that column as Auto incremental number or a surrogate key. know more at Sql server dba online course
19. What is Bulkcopy in SQL?
Bulkcopy is a tool used to copy large amount of data from Tables. This tool is used to load large amount of data in SQL Server.
20. What will be query used to get the list of triggers in a database?
Query to get the list of triggers in database-