Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are new to SQL Server and to databases in general, then the concept of schema probably is confusing. A basic understanding is:</p> <pre><code>A schema is the unit of security (as described [here][1] if you must know). A database is the unit of backup and recovery. </code></pre> <p>If you are new to SQL Server, security may not be top on your mind. You think "users have access to databases, so databases are the unit of security". Not only does that make sense, but that is how many databases implement security.</p> <p>However, it is not particularly flexible. Say we are both working in a database, and I want to give you execute permissions on all my stored procedures -- even ones I create in the future. With a schema, it is easy. I grant you execute permission on the schema, anything new you can use.</p> <p>If I had to do this at the database-level, then I would have a few inferior options:</p> <ol> <li>Grant you access to <em>all</em> stored procedures. Even the one that deletes everything on the server that only special people have access to. And, even the ones developed by someone else in the database.</li> <li>Grant you access to all <em>existing</em> stored procedures. But then I add a new one for the application, and your application stops working.</li> <li>Break everything up into different databases, but then that becomes a management nightmare.</li> </ol> <p>This is only intended as an example of how schemas manage security within a database. SQL Server makes them pretty easy to use by defaulting everything to <code>dbo</code> (which stands for "database owner"). Their power only becomes apparent when you have a situation needing them. In the meantime, just get used to using <code>dbo</code> in certain contexts (such as four-part naming for accessing objects on linked servers and for calling user-defined functions).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload