# 2019/0130/ERmod雞爪圖\&C#if、for時間複雜度

## 模型邏輯

實體 (真實存在的事物/概念性的)

弱實體 (依附強實體為生的) 雙同心長方形表示 (沒有主鍵所以才要依附)

![](/files/-LXIixDPNhulpbFg_xS2)

![](/files/-LXIjMhjhuHMzwlgxmOb)

這個員工消失 那他的眷屬對公司也沒用

姓名 複合屬性  姓 與 名

要不要切 是要看 查詢條件

常常要查姓但是名一堆不一樣的 只能使用 like 陳\* 模糊查詢 會造成效能低

具有主鍵特性但不是主鍵   稱為候選鍵

沒有被選重的稱為 交替鍵 unik 不會重複的值

多值屬性 ex 電話可以不只留一隻 (多出一張資料表) 同心雙橢圓

![](/files/-LXIjMhpRWL77NsrWQeL)

在資料庫實做中 null 不等於空 null是一種空值

衍生屬性  用算出來的  虛線橢圓

![](/files/-LXIjMhqW18-LqXm1Anb)

ex 生日 算出 年齡 ((年齡欄位儲存計算公式)

&#x20;

![](/files/-LXIjMhwl_sHMtBASex7)

1:1 、  1:M 、 M:1 、 M:N

![](/files/-LXIjh3HpZzgqkWQVwVo)

## 雞爪圖&#x20;

可以直接表現 部分參與個數與強制性

靠實體表基數    靠關係表強不強制

![](/files/-LXIjh3JPaHatHk4r41C)

基數限制條件表示法 ( 1 , N )

一元關係  員工資料表裡面 包含主管

有些員工有主管屬性

員工跟主管的關係為一元關係

三元關係 = 兩個二元

客戶 訂購 員工 訂購 訂單  &#x20;

員工 處理 訂單 下 客戶   (實做三張資料表)

### 關係的屬性

1對多   客戶 下 訂單(數量)                 並不會錯

但實際上 屬於  (數量)應該屬於下這個關係的屬性

多對多  學生 選修(成績) 課程           獨立出一張表 KEY 為 學生  課程  部分功能相依      選修明細

成績無法放在學生或課程裡面 只能放在選修裡

綱要 Schema

資料庫全體資料的邏輯結構與特徵描述不涉及值

學生資料表(資料型態)(學號 姓名 系別

實例 instance 模擬資料

## C#網站aspwebfrom

if ( 條件 運算式 ) {條件成立執行} else { 條件不成立 }

### 巢狀&#x20;

#### 所有條件全部跑一次

```
 if (age >= 0)
            {
                if (age > 20)
                    Response.Write("全票");

                if (age >= 7 && age <= 20)
                    Response.Write("半票");

                if (age <= 6)
                    Response.Write("免票");
            }
            else
                Response.Write("年齡輸入錯誤");
```

### 收尋式&#x20;

#### 滿足一種條件即結束

```
if (age >= 0)
            {
                //搜尋式
                if (age > 20)
                    Response.Write("全票");
                else if (age <= 6)
                    Response.Write("免票");
                else
                    Response.Write("半票");
            }
            else
                Response.Write("年齡輸入錯誤");
```

switch

case

16384/100

16.384%10

16384/10

for ( 計數器起始值 ; 結束值 ; 增量值 ) { }

已經知道要執行幾次

變數跟字串聯階必須+號

```
 //用for回圈顯示出下列圖形
            //*
            //**
            //***
            //****
            //*****




 for (int i = 1; i <= 5; i++)
            {
                for (int j = 1; j <= i; j++)
                   { Response.Write("*");}

                Response.Write("<br />");
            }
            
            *****
            *****
            *****
            *****
            *****
            
            
            
                        for (int i = 1; i <= 5; i++)
            {
                for (int j = 1; j <= i; j++)
                   { Response.Write("*");}

                Response.Write("<br />");
            }

```

巢狀迴圈   時間複雜度  On平方


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://johch3n611u.gitbook.io/c50108/ju-li-cheng-bei/201901/20190130-liao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
