📜  DBMS中Schema和Instance的区别

📅  最后修改于: 2021-09-14 02:24:46             🧑  作者: Mango

1. 实例:
实例是存储在特定时刻的信息的集合。某些 CRUD 操作可以更改实例,例如添加、删除数据。可以注意到,任何搜索查询都不会在实例中进行任何类型的更改。

例子 –
假设我们的数据库中有一个名为 School 的表老师,假设该表有 50 条记录,因此数据库实例现在有 50 条记录,明天我们将再添加 50 条记录,因此明天实例总共有 100 条记录。这称为实例。

2. 架构:
Schema 是对数据库的整体描述。数据如何存储在数据库中的基本结构称为模式。

模式有两种类型:逻辑模式和物理模式。

  1. 逻辑架构 –它描述了在逻辑级别设计的数据库。
  2. 物理架构 –它描述了在物理级别设计的数据库。

例子 –
假设我们的数据库中有一个表老师学校,老师表需要他们表中的名字,dob,doj,所以我们设计了一个结构:

Teacher table
name: String
doj: date
dob: date 

上面给出的是表老师的模式。

Schema 和 Instance 的区别:

Schema Instance
It is the overall description of the database. It is the collection of information stored in a database at a particular moment.
Schema is same for whole database. Data in instances can be changed using addition, deletion, updation.
Does not change Frequently. Changes Frequently.
Defines the basic structure of the database i.e how the data will be stored in the database. It is the set of Information stored at a particular time.