问题描述
SQL Server中的数据库和架构之间有什么区别?两个都是表和数据的容器。
What's the difference between a Database and a Schema in SQL Server? Both are the containers of tables and data.
如果一个模式被删除,那么该模式中包含的所有表也会自动删除,或者当数据库已删除?
If a Schema is deleted, then are all the tables contained in that schema also deleted automatically or are they deleted when the Database is deleted?
推荐答案
数据库是主容器,它包含数据和日志文件以及其中的所有模式。你总是备份一个数据库,它是一个独立的单元。
A database is the main container, it contains the data and log files, and all the schemas within it. You always back up a database, it is a discrete unit on its own.
模式就像数据库中的文件夹,主要用于将逻辑对象组合在一起
Schemas are like folders within a database, and are mainly used to group logical objects together, which leads to ease of setting permissions by schema.
drop schema test1
在使用模式时无法删除模式。您必须先从模式中删除所有对象。
You cannot drop a schema when it is in use. You have to first remove all objects from the schema.
相关阅读:
- What good are SQL Server schemas?
- MSDN: User-Schema Separation
这篇关于数据库和模式之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!