Microsoft SQL Server is a relational database management system. It is a software product developed by Microsoft. As a database server, it’s primary function is to store and retrieve data as requested by other software applications. The data server may run either on the same computer or on another computer across a network. Microsoft aims at different audiences and for workloads ranging from small single machine applications to large Internet-facing applications by marketing at least a dozen different editions of Microsoft SQL Server with many concurrent users.
SQL stands for ‘Structured Query Language’ and is used for communicating with the databases. According to ANSI, SQL is the standard query language for Relational Database Management Systems (RDBMS) that is used for maintaining them and also for performing different operations of data manipulation on different types of data. Basically, it is a database language that is used for the creation and deletion of databases, and it can be used to fetch and modify the rows of a table and also for multiple other things
A primary key is used to uniquely identify all table records. It cannot have NULL values, and it must contain unique values. A table can have only one primary key that consists of single or multiple fields.
Now, we will write a query for demonstrating the use of a primary key for the Employee table:
//
CREATE TABLE Employee (
ID int NOT NULL,
Employee_name varchar(255) NOT NULL,
Employee_designation varchar(255),
Employee_Age int,
PRIMARY KEY (ID)
);
Parameters | Clustered Index | Non-clustered Index |
Used for | Sorting and storing records physically in memory | Creating a logical order for data rows. Pointers are used for physical data files |
Methods for storing | Stores data in the leaf nodes of the index | Never stores data in the leaf nodes of the index |
Size | Quite large | Comparatively, small |
Data accessing | Fast | Slow |
Additional disk space | Not required | Required to store indexes separately |
Type of key | By default, the primary key of a table is a clustered index | It can be used with the unique constraint on the table that acts as a composite key |
Main feature | Improves the performance of data retrieval | Should be created on columns used in Joins |
COALESCE function takes a set of inputs and returns the first non-null value.
Syntax: COALESCE(val1,val2,val3,……,nth val)
Example: SELECT COALESCE(NULL, 1, 2, ‘MYSQL’)
Output: 1
Normalization and denormalization are basically two methods used in databases.
Normalization is used in reducing data redundancy and dependency by organizing fields and tables of databases. It involves constructing tables and setting up relationships between those tables according to certain rules. The redundancy and inconsistent dependency can be removed using these rules to make it more flexible.
De-normalization is contrary to normalization. In this, we basically add redundant data to speed up complex queries involving multiple tables to join. Here, we attempt to optimize the read performance of a database by adding redundant data or by grouping the data.
Constraints are used to specify the rules concerning data in the table. It can be applied for single or multiple fields in an SQL table during creation of table or after creationg using the ALTER TABLE command. The constraints are:
The PRIMARY KEY constraint uniquely identifies each row in a table. It must contain UNIQUE values and has an implicit NOT NULL constraint. A table in SQL is strictly restricted to have one and only one primary key, which is comprised of single or multiple fields (columns).
A UNIQUE constraint ensures that all values in a column are different. This provides uniqueness for the column(s) and helps identify each row uniquely. Unlike primary key, there can be multiple unique constraints defined per table.
A FOREIGN KEY comprises of single or collection of fields in a table that essentially refer to the PRIMARY KEY in another table. Foreign key constraint ensures referential integrity in the relation between two tables.
Data Integrity is the assurance of accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data. It also defines integrity constraints to enforce business rules on the data when it is entered into an application or a database.
Entity: An entity can be a real-world object, either tangible or intangible, that can be easily identifiable. For example, in a college database, students, professors, workers, departments, and projects can be referred to as entities. Each entity has some associated properties that provide it an identity.
Relationships: Relations or links between entities that have something to do with each other. For example - The employees table in a company's database can be associated with the salary table in the same database.
SQL Server Reporting Services is a comprehensive reporting platform that includes processing components. Processing components are the basis for the multilayered architecture of SQL Server Reporting Services. Processing components interact with each other to retrieve data and deliver a report.
SQL Server Reporting Services has the following two basic components.
Architecture of SQL Server Reporting Services
The following diagram shows the architecture of SQL Server Reporting Services.
Architecture of SQL Server Reporting Services
Tools and Components of SQL Server Reporting Services architecture
This architecture consists mainly of the following types of components and tools.
Integration Services is a platform for building high performance data integration and workflow solutions, including extraction, transformation and loading (ETL) operations for data warehousing.
This includes graphical tools and wizards for building and debugging packages.
Uses of Integration Services:
One use of Integration Services is to merge data from multiple data stores and update the data to data warehouses and/or data marts. Create the Data Transformation process logic and automate the data loading process.
Architecture of Integration Services
Architecture of Integration Services
Some important components to using Integration Services:
Collation is defined as a set of rules that determine how data can be sorted as well as compared. Character data is sorted using the rules that define the correct character sequence along with options for specifying case-sensitivity, character width etc.
Following are the different types of collation sensitivity:
Apart from this SQL Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka! Click below to know more.
Local variables:
These variables can be used or exist only inside the function. These variables are not used or referred by any other function.
Global variables:
These variables are the variables which can be accessed throughout the program. Global variables cannot be created whenever that function is called.
Auto increment keyword allows the user to create a unique number to get generated whenever a new record is inserted into the table.
This keyword is usually required whenever PRIMARY KEY is used.
AUTO INCREMENT keyword can be used in Oracle and IDENTITY keyword can be used in SQL SERVER.
Datawarehouse refers to a central repository of data where the data is assembled from multiple sources of information. Those data are consolidated, transformed and made available for the mining as well as online processing. Warehouse data also have a subset of data called Data Marts.
A view is a virtual table which consists of a subset of data contained in a table. Since views are not present, it takes less space to store. View can have data of one or more tables combined and it depends on the relationship.
A view refers to a logical snapshot based on a table or another view. It is used for the following reasons:
A Stored Procedure is a function which consists of many SQL statements to access the database system. Several SQL statements are consolidated into a stored procedure and execute them whenever and wherever required which saves time and avoid writing code again and again.
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.
Using String Operators:: LIKE, NOT LIKE
a% ----> starts with a
%a ----> ends with a
MS SQL, Machine Learning, Software programming, etc are the areas requiring talented professionals to handle their upcoming projects. Entering to the arena now will empower your career with high salary and position. MS SQL employees having in-depth knowledge and skill-based training in MS SQL are able realize their smooth ways to accomplish their career goals. A candidate of MS SQL applicant gets a minimum salary of 40, 000 dollars per annum, which get to double with experience. However, the salaries are very dependent upon the location, business, and the company’s requirements.
The questionnaire on MS SQL interview questions has been drafted by team of specialists to train fresh candidates in understanding the tricks and techniques to answer interview questions. Often, interviewers ask a simple question making it more elaborative and confusing for the candidates. This article has tried providing relevant answers to entire advanced MS SQL interview questions. It also has answers for MS SQL interview questions for experienced professionals. If any students still require more explanation, then they may drop in a message to our experts regarding MS SQL interview questions for experienced professionals. Join MS SQL Training in Noida, MS SQL Training in Delhi, MS SQL Training in Gurgaon