# 資料庫系統期中博物館
館長: Brendon
## 第一大題 名詞解釋
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm

* Domain:attribute的定義域
* Attribute: Attributes are properties used to describe an entity
* Entity:屬性中有primary key
* Relationship:兩實體屬性相關
* 1:N relationshop:畫一張圖 entity 1 relationshop N entity
* Entity set:實體集合
* Weak entity type:Entity的key是partial key

* Relation state:Relation 在一個時間點的資料狀態
* Atomic attribute:不可再分割的attribute
* Entity integrity constraint: 限制此entity中的primary key不可為null and 不可與其他entities重疊
* Cardinality ratio constraint: 兩個entity之間參與的比例
Ex. One-to-one (1:1), one-to-many (1:N) and many-to-many (M:N).
* Unsafe query:Query出來的結果可能是無限集合
Ex. {t | NOT (EMPLOYEE(t))}
* Hierachical data model:Entity之間有階層的關聯
* Internal database schema:對於一個database中的每個entity type中內部的構造
* DDL:資料定義語言(Data Definition Language, DDL)用來宣告(或建立)資料庫物件針對Table, View或Database做建立(Create)、刪除(Drop)、更改(Alter)等動作。
* Composition attributes:此attribute由多個attribute組合而成
* Total participation:該entity type的所有entities皆須藉由relationship對應至另一個entity type,不可有沒對應的entity存在
* Relation instance:在relation中某一個時間點,所存在的state狀況
* referential integrity constraint:為schema based限制,用以限制foreign key的value為NULL或存在其關聯資料庫中的Primary Key值
* Union Compatible使用union操作的條件:
* 相同的attribue數
* 每個對atttribute的domain(DATA TYPE)必須相同
## 第二大題
* **2008**


* **2010**



* **2011**


* **2013**

* **2014**



* **2021**

https://medium.com/@kumarjai2466/er-to-relational-mapping-ac84b3c9f258
## 第三大題
* **2008**

A:An unsafe query is a query in relational calculus which returns an infinite number of results. It is important to disallow such queries because a database needs to return results for a query after a finite amount of time. An example of an unsafe query is:
{el¬(e∈employees)}
This query returns all objects which are not employees. The results of this query is infinite and thus the query is unsafe.
* **2010**

(1) Name is not a candidate key because it’s not a unique attribute.
(2) Sid is a candidate key because it’s a unique attribute.
* **2011**

* **2013**



* **2014**

* **2021**


## 第四大題
* **2008**


* **2010**




* **2011**


* **2013**


* **2014**

* **2021**
