---
# System prepended metadata

title: MYSQL資料庫
tags: [puli_foodmap]

---

# MYSQL資料庫

###### tags: `puli_foodmap` 

### MYSQL
[資料庫共筆](https://hackmd.io/@d_oDmKd5Rc2S8K86vAS0nw/BkF6HH2Vv/https%3A%2F%2Fhackmd.io%2Fc%2FBkF6HH2Vv%2Fedit%3Fedit)
[常用的資料庫資料型態](https://ithelp.ithome.com.tw/m/articles/10203456?sc=iThelpR)

### 基本語法
- 什麼時候要加 **""** 和 **''**
雙引號 **""** 裡的字需經過編譯器解釋然後再當作HTML code輸出
單引號 **''** 裡的字不需要解釋，直接輸出
``` php=
$abc='I love u';
echo $abc;      //结果是:I love u
echo '$abc';    //结果是:$abc
echo "$abc";    //结果是:I love u
```

-  從 puli_restaurant 的資料表中選擇所有欄位
``` mysql=
SELECT * FROM puli_restaurant
```

- 在 puli_restaurant 新增一家餐廳
``` mysql=
INSERT INTO puli_restaurant 
    ( Restaurant_name, Restaurant_TEL, Restaurant_intro, Restaurant_time, Restaurant_photo, Restaurant_comment, Restaurant_price, Restaurant_address, Restaurant_x, Restaurant_y)
    VALUES
    ( '$Restaurant_name', '$Restaurant_TEL', '$Restaurant_intro', '$Restaurant_time', '$Restaurant_photo', '$Restaurant_comment', '$Restaurant_price', '$Restaurant_address', '$Restaurant_x', '$Restaurant_y')
```

- 在 puli_restaurant 刪除一家餐廳
``` mysql= 
DELETE FROM puli_restaurant WHERE Restaurant_ID = $Restaurant_ID
```
