Find jobs | Jobseekers
Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career Services Resume Services Interview questions Articles Books
Content
SQL Server part 1
SQL Server part 2
SQL Server part 3
SQL Server part 4
SQL Server part 5
SQL Server part 6
SQL Server part 7
SQL Server part 8
SQL Server part 9
SQL Server cursor
SQL Server replication
Structured query language
SQL Server architecture
SQL Server constraints
SQL Server cursors
Data Mining
Data warehousing
SQL Server DTS
SQL Server functions
SQL Server indexes
SQL Server joins
SQL Server locks
SQL Server Net integration
SQL Server optimization
SQL Server replication
SQL reporting services
SQL service broker
SQL Server stored procedures
SQL Server table
SQL Server transactions
SQL Server transactions Architecture
SQL Server triggers
SQL Server views
SQL Server XML integration
SQL Server DDL
SQL Server DML
SQL Server DCL
SQL Server identifier
SQL Server data integrity
SQL Server accessing data
SQL Server subqueries
SQL Server cube operator
SQL Server insert data
SQL Server distributed queries
SQL Server index tuning
 
ASP.NET | ADO.NET | AJAX
C#.NET | VB.NET | PHP
NET Remoting | NET Interview
  
C | C++ | Java | Oops
Data Structure | OS
   
Database concepts | Oracle
SQL Server | Biztalk | Sharepoint
Notification services
Reporting Services
Service-oriented architecture
Data warehousing | MySQL
  
Project Management 
Linux | Testing | Networking
Software engineering 
  
UML | XML | HTML | SOAP 
CSS | VBScript  | Web Services
   
CV Cover letter | Interview 
HR | Soft skills | GD 
Working from Home 
Tutorial
ASP.NET | VB.NET | C#.NET     
Remoting.NET | Web service
Remoting overview | ADO.NET
UML | Sql server 
More links
How to transfer or export SQL Server 2005 data to Excel 
Books on SQL Server
Beginners Guide to SQL Server Integration Services Using Visual Studio 2005 

SQL Server views


SQL Server views - Interview questions

<<Previous  Next>>

SQL Server views - August 29, 2008 at 18:00 PM by Nishant Kumar

Define Views.

  • View can be created to retrieve data from one or more tables.
  • Query used to create view can include other views of the database.
  • We can also access remote data using distributed query in a view.


Views - October 24, 2008 at 18:10 pm by Rajmeet Ghai

What is Indexed view? How to create it?

In an indexed view, the data is already computed and stored. Data can be accessed by a unique index. This index is a clustered index. In order to create an index the syntax is

CREATE [UNIQUE], [CLUSTERED | NONCLUSTERED] INDEX index_name
ON {view}
[WITH <index_option>]
[ON filegrp]

What are partitioned views and distributed partitioned views?

Partitioned views allow data in a large table to be split into smaller tables. These small tables are called as member tables. The split is done based on range of data values in one of the columns.

In a distributed portioned view, each member table is on a separate member server. This means that the member tables are distributed. To locate these tables easily, the database name on each server should be same.

What functions can a view be used to performed?

Functions of View:-

  • Subset data of a table
  • Can join multiple tables values into one
  • They can act as aggregated tables. i.e. a view can be used to store Sum, average of values
  • Views can be nested and can be used for abstraction

Define views.

Answer
A view can be considered as a virtual table. It does not physically exist. It is based on the result set of a SQL statement. A view contains rows and tables just like a real table.

Describe the functionalities that views support.

Answer

  • Views can subset data in a table
  • They can join multiple tables into one virtual table
  • Views can provide security and decrease complexity
  • They save space because only their definition is stored.
  • They can also be used to create abstraction
  • Materialized views are commonly used in data warehousing. They represent a snapshot of the data from remote sources.

Views can create other calculated fields based on values in the real underlying tables

Explain Indexed views and partitioned view with their syntax.

Answer
Indexed view:

An index view has a unique clustered index created on it. They exist as rows on the disk. Because they are saved on the disk, the response time to a query is fast at the cost of space consumption. They are more commonly used in scenarios when data modification is less.

Syntax:
Create Index CREATE [UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name ON table_name

The view is created using the CREATE VIEW synatx

Partitioned view:

Partitioned view joins the horizontally portioned data. This data may belong to one ore more servers. It makes the data appear as one table. A portioned view can either be local or distributed. A local portioned view resides on the same instance of the SQL server while the distributed may reside on a different server.

Syntax:

The view is then created by UNIONing all the tables and an updateable partitioned View results

Server 1 :
CREATE TABLE Customer1 (CustomerID INTEGER PRIMARY KEY CHECK (CustomerID BETWEEN 1 AND 32999), ... -- Additional column definitions)

Similar tables created for Server 2 and 3

Partitioned view for server 1
CREATE VIEW Customers AS
SELECT * FROM CompanyDatabase.TableOwner.Customer1
UNION ALL
SELECT * FROM Server2.CompanyDatabase.TableOwner.Customer2
UNION ALL
SELECT * FROM Server3.CompanyDatabase.TableOwner.Customer3

What are the restrictions that views have to follow?

Answer

  • Since a view is a virtual table – columns of the view cannot be renamed. To change anything in the view, the view must be dropped and create again.
  • The select statement on the view cannot contain ORDER BY or INTO TEMP
  • When a table or view is dropped, any views in the same database are also dropped.
  • It is not possible to create an index on a view
  • It is not possible to use DELETE to update a view that is defined as a join.

<<Previous  Next>>





 
Today's Hot Jobs
C++  SQL Server
.NET  Java  Oracle
Finance  Marketing
Seekers  Employers
Copyright © 2008 CareerRide.com. All rights reserved.