#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171

    Understanding VIEWS in SQL


    Are these statements true or false?

    1 - Views do not have a tabular structure, they are just custom designed queries and do not carry any data and so they take only few bytes of data.

    2 - It takes longer processing time to retrieve data from a view compared to a table because the system has to query the table first and build the view, then retrieve the data from the view.

    3 - Views are only SELECT statemets.

    4 - Creating views is limiting too. One won't be able to change the tables structure as the views wont be able to work no more.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,127
    Rep Power
    4274
    1 true
    2 false
    3 true
    4 true or false, depending on the change
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171
    Originally Posted by r937
    1 true
    2 false
    3 true
    4 true or false, depending on the change
    2 doesn't make sense to be false.
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,127
    Rep Power
    4274
    Originally Posted by zxcvbnm
    2 doesn't make sense to be false.
    that's because this part is wrong --
    because the system has to query the table first and build the view, then retrieve the data from the view.
    it doesn't "build the view" that way at all

    instead, it uses the view definition to merge with the SELECT statement that references the view, then simple executes the resulting query

    (yeah, it takes a few more cycles to combine the sql from two sources, but that's insignificant compared to data retrieval)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo