SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MS SQL: Whats the difference between view and joins ?

    hello,
    I have been working with MS SQL for some time, and i always use joins in making my queries.

    However, i would like to know the difference between views and joins.

    And why must my objects be always dbo e.g table dbo.table_name
    if i have a login as afrika, why cant i create my tables as dbo.afrika

    thanks
    Last edited by afrika; Dec 2, 2004 at 14:10.

  2. #2
    SitePoint Guru hgilbert's Avatar
    Join Date
    Dec 2004
    Location
    London
    Posts
    839
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    views and joins can't be compared as they are very different things
    (ie you could have join inside a view)

    A View is like your MS Access Query
    it will spit out results such as
    "Give me the names of everyone older than 30 that plays tennis" say

    The different between a VIEW and a Stored Procedure
    is that a View will only use the "SELECT" statement
    you can't update or delete records with a View
    (very simplistic answer there are other differences too)

    Now join is a different thing all together
    its a function used in a SQL Statement

    SELECT blah blah FROM tblBlog, tblBlig WHERE .. .. etc INNER JOIN

    (reason I am not giving you a more readable code is because I never user JOINS in any of my queries so I forgot the syntax! )

    dbo is standard for database object.
    much like you have say an Excel object
    excel.application.forms .. etc

    its just their standard object model.
    the hierarchy can go even higher levels

    something loosely like:

    mssql01.databases.db_123.tables.[dbo].[tblPeople]

    try and see what happens when you ommit dbo on your queries.
    you still get the same result.


    Quote Originally Posted by afrika
    hello,
    I have been working with MS SQL for some time, and i always use joins in making my queries.

    However, i would like to know the difference between views and joins.

    And why must my objects be always dbo e.g table dbo.table_name
    if i have a login as afrika, why cant i create my tables as dbo.afrika

    thanks

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot, I tend to use joins a lot,


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •