SQL Server Interview Questions Part2
- Get link
- Other Apps
Few important questions for SQL Server asked ASP.Net Developer. Part- 2
Indexes-
Indexes are used to query data faster from a table. Indexing avoids full table scan.
Create Index IX_customer_amount on tblcustomer (purchase_amount ASC)
So this index will store purchase amount in ascending order.
Purchase amount
2000
5000
5500
7500
9000
To view all indexes on a table either go to object explorer in SQL management studio or write below query which will list all indexes on given table.
sp_Helpindex tblCustomer
To drop an index:
drop index <index_name>
Clustered and NonClustered Indexes
The clustered index determines the physical order of data in a table.
A table can have only one clustered index.
Generally, if we create a table with an id column and mark it as primary key, automatically it creates a clustered index if no index specified while creating a table.
One clustered index can contain more than one columns then it is called composite index.
Clustered indexes do not require any additional storage.
Non Clustered index contain multiple columns.
Create NonClustered Index IX_customertbl_amount on customertbl
Non clustered indexes require additional storage.
Too many indexes may affect performance as apart from select there are insert, update and delete operation also.
View:
It is a virtual table in SQL.
Create view viewCustomer
as
select id, cust_name, amount,city from customertbl
Now we can get the record from view.
select * from viewCustomer
We can create a view for join query, so in this case, we can query data directly from view and
so we can avoid using join query.
We can not pass the parameter to view. Order clause is not applicable with View.
The view cannot be on the temporary table.
Trigger:
A trigger is a SQL block which is executed when a DML statement (insert, update, delete) is executed on a table.
3 types of Triggers
Indexes-
Indexes are used to query data faster from a table. Indexing avoids full table scan.
Create Index IX_customer_amount on tblcustomer (purchase_amount ASC)
So this index will store purchase amount in ascending order.
Purchase amount
2000
5000
5500
7500
9000
To view all indexes on a table either go to object explorer in SQL management studio or write below query which will list all indexes on given table.
sp_Helpindex tblCustomer
To drop an index:
drop index <index_name>
Clustered and NonClustered Indexes
The clustered index determines the physical order of data in a table.
A table can have only one clustered index.
Generally, if we create a table with an id column and mark it as primary key, automatically it creates a clustered index if no index specified while creating a table.
One clustered index can contain more than one columns then it is called composite index.
Clustered indexes do not require any additional storage.
Non Clustered index contain multiple columns.
Create NonClustered Index IX_customertbl_amount on customertbl
Non clustered indexes require additional storage.
Too many indexes may affect performance as apart from select there are insert, update and delete operation also.
View:
It is a virtual table in SQL.
Create view viewCustomer
as
select id, cust_name, amount,city from customertbl
Now we can get the record from view.
select * from viewCustomer
We can create a view for join query, so in this case, we can query data directly from view and
so we can avoid using join query.
We can not pass the parameter to view. Order clause is not applicable with View.
The view cannot be on the temporary table.
Trigger:
A trigger is a SQL block which is executed when a DML statement (insert, update, delete) is executed on a table.
3 types of Triggers
- DML Triggers
- DDL Triggers
- Logon Triggers
- Get link
- Other Apps
Popular
Top 30 ASP.Net Web API Interview Questions and Answers
In this blog, I have collected interview questions and answers of ASP.Net Web API.
CAML Query Tutorial for SharePoint 2013 and 2010 - A Complete tutorial guide
CAML Query is one of the most important topics in SharePoint. CAML Query is the way for querying items from SharePoint objects like List and Library. This blog is helpful in SharePoint 2010 development as well as in SharePoint 2013 development.
Create a static website using Angular 7 - Step by Step tutorial
ASP.Net Core CRUD example using ADO.Net
How to use multiple layout pages in MVC application?
ASP.Net Web API Security
In the previous blog, I wrote about Routing in Web API. I have also explained, How to create a secure Web API? in my earlier blog. If you are new to ASP.Net Web API then please start from the beginning level. What is ASP.Net Web API?
In this blog, let's discuss the Web API security in details.
In this blog, let's discuss the Web API security in details.
What is Web API? When should we use in our projects?
Web API is the Microsoft open source technology for developing REST services based on HTTP protocol. ASP.Net Web API is a framework for building, consuming HTTP based service. The advantage of Web API is that it can be consumed by a wide range of clients like a web browser and mobile applications.
PowerShell Script to export SharePoint List in Excel File - SharePoint Tutorial
In this blog, I will write about "Export SharePoint list items using PowerShell Script".
How to consume RESTful APi from server side code - C#
SharePoint 2013 Server Object Model (SOM) Programming - SharePoint 2013 Tutorial
SharePoint Server Object Model Programming allows you to write code and communicates with SharePoint objects if you are inside the SharePoint context. It provides a set of classes which is executed at the server-side. Server Object Model Programming is the same in SharePoint 2010 and SharePoint 2013.
Tags
Tags
cloud-computing12
sharepoint-201310
dot-net-core9
sql9
interview8
webservice7
angularjs6
entity-framework6
design-pattern5
linq5
sharepoint-programming5
powershell4
socialmedia4
caml3
rest3
workflow3
ajax2
aws2
html2
infopath2
javascript2
json2
oops2
searchservice2
sharepoint-interview2
soa2
timer job2
website2
3tier1
active-directory1
caching1
devops1
fba1
imageupload1
list1
managed-metadata-service1
metadata1
odata1
page-layout1
performance1
run with elevated1
safecontrol1
security1
sharepoint interview questions1
sharepoint security1
sharepoint-architecture1
sharepoint-branding1
sharepoint-migration1
sharepoint-service1
sharepoint-topics1
sharepointlist1
site-definition1
soap1
uls1
validation1
viewstate1
xml1
Show more
Show less
Comments
Post a Comment
Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks