2020-09-28課堂筆記
- 主知識點
- 1.連接查詢
- 2.洗掉(delete、drop、truncate)
- 3.更新(update)
- 4.插入insert into value()
- 5.外鍵與主從表
主知識點
1.連接查詢
1.內連接
select * from pro_dish pd inner join pro_dish_standard pds on pd.id = pds.dish_id

2.左連接(以左為主)
select * from pro_dish pd left join pro_dish_standard pds
on pd.id = pds.dish_id

3.右連接(以右為主)
select * from pro_dish pd right join pro_dish_standard pds on pd.id = pds.dish_id

4.全外連接(FULL outer JOIN)

2.洗掉(delete、drop、truncate)
1.delete用法
delete from 表名 :洗掉表中所有資料,但不改變結構
delete from 表名 where 條件
2.drop用法
drop table 表名
drop database 資料庫名
3.truncate用法
僅洗掉表內的資料,但并不洗掉表本身
truncate table 表名
3.更新(update)
update 表名 SET 列名=value1, 列名=value2, … where 條件
4.插入insert into value()
插入多條時使用values
insert into 表名(欄位,欄位)values(值,值),(值,值)
5.外鍵與主從表
有外鍵的表是從表
先刪從表,后刪主表
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/164203.html
標籤:其他
上一篇:關系型資料庫的外鍵約束與關聯
