Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:37:01+00:00 2026-05-15T04:37:01+00:00

Possible Duplicate: What are views good for? hi, i have a doubt what is

  • 0

Possible Duplicate:
What are views good for?

hi,
i have a doubt what is a view. where should we use and what is the use of view.
is there any good reference for views. thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:37:02+00:00Added an answer on May 15, 2026 at 4:37 am

    Please, have an eye out this View (database) Wikipedia article.

    In short, a View can be used with more than SQL Server, it is a SQL Standard.

    A VIEW is generally used:

    1. To present the information data on a different point of view;
    2. To simplify the access to the information of a high-level complexity of the database schema;
    3. To prevent direct access to database tables (for security purposes)(less popular these days because of ORM tools);
    4. Some "reality" is just simpler with a VIEW.

    Here’s an example when the database schema stores hierarchical data in multiple database tables.

    CREATE TABLE Vehicules (
        VId int IDENTITY(1, 1) PRIMARY KEY
        , VDescription nvarchar(20) NOT NULL
    )
    
    CREATE TABLE MotoredVehicules (
        MvId int IDENTITY(1, 1) PRIMARY KEY
        , MvVId int NOT NULL REFERENCES Vehicules (VId)
        , MvMake nvarchar(20) NOT NULL
    )
    
    CREATE TABLE MotorHP (
        MhpId int IDENTITY(1, 1) PRIMARY KEY
        , MhpMvId int NOT NULL REFERENCES MotoredVehicules (MvId)
        , MhpHP decimal(6, 2) NOT NULL
    )
    
    CREATE TABLE VehiculesWheels (
        VwId int IDENTITY(1, 1) PRIMARY KEY
        , VwVId int NOT NULL REFERENCES Vehicules (VId)
        , VwNumberOfWheels int NOT NULL
    )
    
    insert into Vehicules (VDescription) values (N'Bicycle')
    GO
    insert into Vehicules (VDescription) values (N'Motorcycle')
    GO
    insert into Vehicules (VDescription) values (N'Automobile')
    GO
    insert into Vehicules (VDescription) values (N'Yacht')
    GO
    
    -- Inserting the information about the vehicules that have a motor.
    insert into MotoredVehicules (MvVId, MvMake) (
        select v.VId
                , N'Harley Davidson'
            from Vehicules as v
            where v.VDescription LIKE N'Motorcycle'
    )
    GO
    insert into MotoredVehicules (MvVId, MvMake) (
        select v.VId
                , N'Sea-Ray'
            from Vehicules as v
            where v.VDescription LIKE N'Yacht'
    )
    GO
    insert into MotoredVehicules (MvVId, MvMake) (
        select v.VId
                , N'Mercedes'
            from Vehicules as v
            where v.VDescription LIKE N'Automobile'
    )
    GO
    
    -- Inserting motor HP for the motorized vehicules.
    insert into MotorHP (MhpMvId, MhpHP) (
        select mv.MvId
                , 350
            from MotoredVehicules as mv
            where mv.MvMake LIKE N'Sea-Ray'
    )
    GO
    insert into MotorHP (MhMvId, MhpHP) (
        select mv.MvId
                , 280
            from MotoredVehicules as mv
            where mv.MvMake LIKE N'Mercedes'
    )
    GO
    insert into MotorHP (MhpMvId, MhpHP) (
        select mv.MvId
                , 930
            from MotoredVehicules as mv
            where mv.MvMake LIKE N'Harley Davidson'
    )
    GO
    
    -- Inserting the number of wheels for wheeled vehicules.
    insert into VehiculesWheels (VwVId, VwNumberOfWheels) (
        select v.VId
                , 2
            from Vehicules as v
            where v.VDescription IN (N'Bicycle', N'Motorcycle')
    )
    GO
    insert into VehiculesWheels (VwVId, VwNumberOfWheels) (
        select v.VId
                , 4
            from Vehicules as v
            where v.VDescription LIKE N'Automobile'
    )
    GO
    

    This relational model is not very comprehensive by itself. We could have used one only table to insert them all with all of their specifications, and let NULL the fields with no data. However, because of some hierarchy reasons, we have created tables for specifications about different type of Vehicules. Thus, when you want to have the information about vehicule in particular, it is not very practical, as you have to join the tables every now and then you have to retrieve the information. Here, it could become practical to have a View like so:

    CREATE VIEW WheeledMotoredVehiculesView AS
        select v.VId
                , mv.MvMake
                , hp.MhpHP
                , vw.NumberOfWheels
                , v.VDescription
            from Vehicules as v
                left join MotoredVehicules as mv on mv.MvVId = v.VId
                left join MotorHP as hp on hp.MhpMvId on mv.MvId
                left join VehiculesWheels as vw on vw.VwVId = v.VId
    GO
    
    CREATE VIEW MotoredVehiculesView AS
        select v.VId
                , mv.MvMake
                , hp.MhpHP
                , v.VDescription
            from Vehicules as v
                left join MotoredVehicules as mv on mv.MvId = v.Id
                left join MotorHP as hp on hp.MhpMvId = mv.MvId
    GO
    
    CREATE VIEW WheeledVehicules AS
        select v.VId
                , vw.NumberOfWheels
                , v.VDescription
            from Vehicules as v
                left join VehiculesWheels vw on vw.VwVId = v.VId
    GO
    

    Then, instead of having to write the select contained within each of both above-created views each time you need to access some information data about a given vehicule, you simply query against the appropriate view itself:

    select *
        from MotoredVehiculesView
    

    Or whatever information you need.

    Disclaimer: This code has not been tested and was written directly for example purposes only. It might not work as-is.

    I hope this helps you better understand views, somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Escape @ character in razor view engine how can i use '@'
Possible Duplicate: Any known problems/bugs with objectContribution (popup) to CVS History view? It's not
Possible Duplicate: Emitting unencoded strings in a Razor view I have a string that
Possible Duplicate: Any ideas on how I could implement a grid-view in CSS? -
Possible Duplicate: Any ideas on how I could implement a grid-view in CSS? -
Possible Duplicate: Is it possible to have an indexed view in MySQL? Possible duplicate:
Possible Duplicate: How can I pass data to any template from any view in
Possible Duplicate: add and remove views in android dynamically? In Iphone, the view is
Possible Duplicate: How to use multiple view engines in ASP.NET MVC application I am
Possible Duplicate: Create a UIViewController that contain a UIViewController I have a parent view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.