Welcome to our SQL Server Interview Questions Blog! Structured Query Language (SQL) is a standard language for managing relational databases. SQL Server, developed by Microsoft, is one of the most widely-used database management systems in the world. With its robust features and capabilities, SQL Server is a preferred choice for many organizations.
If you are preparing for an SQL Server Interview or looking to enhance your skills in this domain, this blog is the perfect resource for you. Here, we have compiled a list of frequently asked SQL Server Interview Questions along with their detailed answers, which will help you gain a deeper understanding of this tool and its applications.
Whether you are a beginner or an experienced professional, these questions will provide you with a comprehensive overview of SQL Server and its functionalities, enabling you to crack your interview with confidence. So, without further ado, let's dive into the world of SQL Server and learn everything you need to know to excel in your career!
These SQL Server Interview Questions are divided into two categories
Most frequently asked SQL Server Interview Questions
Ans: SQL is a language that is used to communicate with the database and this language supports operations like insertion, update, retrieval, and deletion.
Ans: SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties.
Ans: To hide a SQL Server instance, we need to make a change in SQL Server Configuration Manager. To do this launch SQL Server Configuration Manager and do the following: select the instance of SQL Server, right-click, and select Properties. After selecting properties you will just set Hide Instance to “Yes” and click OK or Apply. After the change is made, you need to restart the instance of SQL Server to not expose the name of the instance.
Ans: A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore the table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A non-clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on the disk. The leaf node of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
Ans: The new commands are to TRY and CATCH.
Although they do not directly replace any specific command, in many respects the TRY and CATCH have been used over the RAISERROR command.
The TRY block is for the business logic and the CATCH logic is for capturing the error.
Ans: Both the primary key and unique key enforce the uniqueness of the column on which they are defined. But by default, the primary key creates a clustered index on the column, whereas the unique one creates a nonclustered index by default. Another major difference is that the primary key doesn't allow NULLs, but the unique key allows one NULL only.
|If you want to enrich your career and become a professional in SQL Server, then visit Tekslate - a global online training platform: "SQL Server Training" This course will help you to achieve excellence in this domain.|
Ans: Below is the list of properties the relational table should have
Ans: They specify a search condition for a group or an aggregate. But the difference is that HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Ans: ACID is used for evaluating application and database architecture. Below are the ACID properties –
Ans: This is the combination of fields/columns which are used to uniquely specify a row. The primary key has a unique constraint defined on the column and the value in the column cannot be NULL.
Ans: A table can have one of the following index configurations:
Ans: SQL Profiler is a graphical tool that allows system administrators to monitor events in an instance of Microsoft SQL Server. You can capture and save data about each event to a file or SQL Server table to analyze later. For example, you can monitor a production environment to see which stored procedures are hampering performance by executing too slowly.
Use SQL Profiler to monitor only the events in which you are interested. If traces are becoming too large, you can filter them based on the information you want, so that only a subset of the event data is collected. Monitoring too many events adds overhead to the server and the monitoring process and can cause the trace file or trace table to grow very large, especially when the monitoring process takes place over a long period of time.
Ans: The sp_MSforeachdb system stored procedure accepts the @Command parameter which can be issued against all databases. The '?' is used as a placeholder for the database name to issue the same command.
The alternative is to use a cursor to process specific commands against each database.
|Checkout Our Latest Blog on SQL Server Integration|
Ans: Hotfixes are software patches that were applied to live systems (the ones still running.) A hotfix is a single, cumulative package that includes one or more files used to address a problem in a software product (i.e. a software bug).
In the Microsoft SQL SERVER context, hotfixes are small patches designed to address specific issues, most commonly to freshly-discovered security holes.
Ans: list of locks available in SQL Server –
Ans: In OLTP - online transaction processing systems relational database design uses the discipline of data modeling and generally follows the Codd rules of data normalization in order to ensure absolute data integrity. Using these rules complex information is broken down into its most simple structures (a table) where all of the individual atomic level elements relate to each other and satisfy the normalization rules.
Ans: The ability to issue a batch 'N number of times' based on the value following the GO command.
In some respects, this functionality replaces using a WHILE loop.
Ans: This command is basically used when a large processing of data has occurred. If a large number of deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.
|Checkout Blog on SQL Server Database Setup in Informatica|
Ans: SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to schedule your own jobs and scripts.
Ans: SELECT * FROM table1 SELECT COUNT(*) FROM table1 SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND did < 2
Ans: The STUFF function is used to overwrite existing characters. Using this syntax, STUFF (string_expression, start, length, replacement_characters), string_expression is the string that will have characters substituted, a start is a starting position, the length is the number of characters in the string that are substituted, and replacement_characters are the new characters interjected into the string. REPLACE function to replace existing characters of all occurrences. Using the syntax REPLACE (string_expression, search_string, replacement_string), where every incidence of search_string found in the string_expression will be replaced with replacement_string.
Ans: Foreign key is used to establish a relationship between the columns of other tables. The foreign key relationship is to be created between two tables by referencing a column of the table to the primary key of another table.
Ans: The two authentication modes of SQL server –
You liked the article?
Like : 1
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.