From ff78076043c6160c1b0021ab585db95da737bdf6 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Jun 2024 12:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b29710d..f93af70 100644 --- a/README.md +++ b/README.md @@ -50,23 +50,23 @@ ## 基礎SQL語法 ### 建議打開資料庫一起操作 ### 新增資料 -``` +``` sql INSERT INTO teaching_sql_2 (student_id,person_id,student_birthday) # 選擇好資料表及覽未明成 Values("M11112029","C123456789","900801") #將參數按照順序放入 ``` ### 更新資料 -``` +```sql UPDATE teaching_sql_2 SET student_birthday='890801' # 將變動的資料設置好 WHERE student_id='M11112030'; #尋找student_id 為 M11112030 的參數 ``` ### 刪除資料 -``` +```sql DELETE FROM teaching_sql_2 # 選擇要刪除的table表 WHERE student_id='M11112029' #刪除studen_id為M1112029 ``` ### 搜尋資料(最需要花時間學的地方,常常會遇到需要串接多個table的時候) #### 所有資料 -``` +```sql select * FROM teaching_sql_1 ``` @@ -78,7 +78,7 @@ select * FROM teaching_sql_1 | M11112029| 林大偉 | EL124 | #### 指定欄位 -``` +```sql select student_name FROM teaching_sql_1 ``` |student_name | @@ -89,7 +89,7 @@ select student_name FROM teaching_sql_1 #### 多個指定欄位 -``` +```sql select student_name,student_id FROM teaching_sql_1 ``` @@ -102,7 +102,7 @@ select student_name,student_id FROM teaching_sql_1 #### 查詢符合條件式的資料 -``` +```sql select * FROM teaching_sql_1 WHERE student_id='M11112030' ``` | student_id | student_name | student_class | @@ -110,7 +110,7 @@ select * FROM teaching_sql_1 WHERE student_id='M11112030' |M11112030| 張威勝| EL125| #### 查詢符合條件式的資料(and) -``` +```sql select * FROM teaching_sql_1 WHERE student_id='M11112030' AND student_class='EL125' # 尋找同時符合 student_id='M11112030' 及 student_class='EL125'的資料 ``` | student_id | student_name | student_class | @@ -119,7 +119,7 @@ select * FROM teaching_sql_1 WHERE student_id='M11112030' AND student_class='EL #### 查詢符合條件式的資料(or) -``` +```sql select * FROM teaching_sql_1 WHERE student_id='M11112030' or student_class='EL124' # 尋找只要符合 student_id='M11112030' 或 student_class='EL124'的資料 ``` | student_id | student_name | student_class | @@ -128,7 +128,7 @@ select * FROM teaching_sql_1 WHERE student_id='M11112030' or student_class='EL1 |M11112029|林大偉|EL124| #### 串接2個資料表 -``` +```sql SELECT teaching_sql_1.student_id, # 找尋teaching_sql_1的 student_id teaching_sql_1.student_class, # 找尋teaching_sql_1的 student_class teaching_sql_2.person_id # 找尋teaching_sql_2的 person_id