---
# System prepended metadata

title: 資料庫系統期中博物館

---

# 資料庫系統期中博物館
館長: Brendon
## 第一大題 名詞解釋
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
![](https://i.imgur.com/Jy1v8Yp.png)

* 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
![](https://i.imgur.com/bhKuqOf.png)

* 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**
![](https://i.imgur.com/tizyT2z.png)
![](https://i.imgur.com/eBYHonr.png)

* **2010**
![](https://i.imgur.com/iWKo5nm.png)
![](https://i.imgur.com/990uAgk.png)
![](https://i.imgur.com/3bt3hzA.png)
* **2011**
![](https://i.imgur.com/Rg1Ij3g.png)
![](https://i.imgur.com/LeLX5jw.png)
* **2013**
![](https://i.imgur.com/BSIxYL3.png)
* **2014**
![](https://i.imgur.com/VvvAtKE.jpg)
![](https://i.imgur.com/vCEIodZ.jpg)
![](https://i.imgur.com/hkPvg6b.png)
* **2021**
![](https://i.imgur.com/dkvGvIR.png)


https://medium.com/@kumarjai2466/er-to-relational-mapping-ac84b3c9f258

## 第三大題
* **2008**
![](https://i.imgur.com/oWlXY7C.png)
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**
![](https://i.imgur.com/gwXK8sc.png)
(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**
![](https://i.imgur.com/ErQ7pbr.png)
* **2013**
![](https://i.imgur.com/MCs3QFM.png)
![](https://i.imgur.com/ywZ0DOu.png)
![](https://i.imgur.com/ovL0lwC.png)
* **2014**
![](https://i.imgur.com/QhYZDn6.png)
* **2021**
![](https://i.imgur.com/G1Kp3rL.png)
![](https://i.imgur.com/RnkBeJQ.png)


## 第四大題
* **2008**
![](https://i.imgur.com/WHWgICI.png)
![](https://i.imgur.com/zgZMh4H.png)

* **2010**
![](https://i.imgur.com/Hluwixa.png)
![](https://i.imgur.com/QWxcLkP.png)
![](https://i.imgur.com/GZNuHh2.png)
![](https://i.imgur.com/v1xfLV4.png)
* **2011**
![](https://i.imgur.com/8psz9T9.png)
![](https://i.imgur.com/B3JlFou.png)
* **2013**
![](https://i.imgur.com/EQRXG2d.png)
![](https://i.imgur.com/ijQaIZV.png)
* **2014**
![](https://i.imgur.com/7irt7od.png)
* **2021**
![](https://i.imgur.com/NluEpHZ.png)

