1. What is View?
A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database . The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.
2. What is Index?
An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application.
A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance. Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, ea ch database table may have only one clustered index. Non-clustered indexes are created outside of the database table and contain a sorted list of references
A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance. Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, ea ch database table may have only one clustered index. Non-clustered indexes are created outside of the database table and contain a sorted list of references
to the table itself.
3. What is the difference between clustered and a non-clustered index?
A clustered index is a special type of index that reorders the wa y records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A nonclustered 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 disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
4. What are the different index configurations a table can have?
A table can have one of the following index configurations:
a. No indexes
b. A clustered index
c. A clustered index and many nonclustered indexes
d. A nonclustered index
e. Many nonclustered indexes
5 .What is cursors?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time. In order to work with a cursor we need to perform some steps in the following order:
a. Declare cursor
b. Open cursor
c. Fetch row from the cursor
d. Process fetched row
e. Close cursor
f. Deallocate cursor
No comments:
Post a Comment
Open Researcher and Contributor ID (ORCID)