🔥 และในวันนี้ แอดจะพาเพื่อน ๆ มาทำความรู้จักกับอีกหนึ่งคำสั่งเจ๋ง ๆ ใน SQL นั่นก็คือเจ้า EXPLAIN นั่นเองจ้าาา ~~
.
👉 เจ้านี่มันคืออะไร มีรายละเอียดและวิธีการใช้งานยังไง ถ้าพร้อมแล้วมาอ่านกันเลยยย !!
.
✨ EXPLAIN - เป็นคำสั่งที่ใช้บอกรายละเอียดในการ Query ข้อมูล เพื่อใช้วัดประสิทธิภาพในการ Query ข้อมูลนั่นเอง
.
👨💻 Syntax
EXPLAIN (QUERY Statement) ; /* ONLY TAKES COMMAND AS PARAMETER */
.
เจ้า EXPLAIN สามารถใช้นำหน้าคำสั่ง SELECT, UPDATE, INSERT และ DELETE ได้
.
📑 วิธีการใช้งาน
🔸 Query ปกติ
SELECT * FROM demo_table WHERE demo_column = 'Demo Value';
.
🔸 Query โดยใช้ EXPLAIN
EXPLAIN SELECT * FROM demo_table WHERE demo_column = 'Demo Value';
.
จะได้ผลลัพธ์ ดังนี้
id: 1
select_type: SIMPLE
table: demo_table
partitions: NULL
type: const
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: const
rows: 1
filtered: 100.00
Extra: NULL
.
🔸 id - id ของ Query EXPLAIN
🔸 select_type - แสดงความซับซ้อนของ Query ผลลัพธ์ด้านบนจะอยู่ในระดับ SIMPLE
🔸 table - แสดงชื่อของตาราง
🔸 partitions - แสดง Partitions ของตารางที่ใช้ใน Query
🔸 type - ระบุประเภทของการ Join
🔸 possible_keys - แสดง Key ที่ใช้
🔸 key - แสดงความยาวของ Key ที่ใช้
🔸 ref - การอ้างอิงที่ใช้ใน Query เมื่อทำการ Comparing Columns
🔸 rows - แสดงจำนวนแถว
🔸 filtered - แสดงเปอร์เซ็นต์ของแถวตามเงื่อนไขที่ระบุ
🔸 Extra - ข้อมูลเพิ่มเติมของ Query
.
🌟 ประโยชน์
- ใช้เพื่อแสดงข้อมูลเกี่ยวกับการ Query
- มีประโยชน์มากในการออกแบบ Schema และ Index
- ใช้ตรวจสอบคำสั่ง Query ว่ามีประสิทธิภาพหรือไม่ เช่น วัดความเร็วในการ Query, ตรวจสอบการแบ่ง - Partition ของตาราง เป็นต้น
- ช่วยเพิ่มประสิทธิภาพในการ Query ข้อมูลใน Database
.
💥 Source : https://arctype.hashnode.dev/mysql-understanding-explain , https://www.geeksforgeeks.org/explain-in-sql/
.
borntoDev - 🦖 สร้างการเรียนรู้ที่ดีสำหรับสายไอทีในทุกวัน
同時也有2部Youtube影片,追蹤數超過12萬的網紅prasertcbs,也在其Youtube影片中提到,-- command create user alpha with encrypted password '1234'; \c demo grant select on table public.benjerry to alpha; grant select, insert, update, del...
「mysql delete table」的推薦目錄:
- 關於mysql delete table 在 BorntoDev Facebook 的最佳解答
- 關於mysql delete table 在 prasertcbs Youtube 的精選貼文
- 關於mysql delete table 在 prasertcbs Youtube 的精選貼文
- 關於mysql delete table 在 How to Delete Table from MySQL Database - YouTube 的評價
- 關於mysql delete table 在 How to remove all MySQL tables from the command-line ... 的評價
- 關於mysql delete table 在 MySQL: DELETE didn't shrink DB size, nor table size 的評價
mysql delete table 在 prasertcbs Youtube 的精選貼文
-- command
create user alpha with encrypted password '1234';
\c demo
grant select on table public.benjerry to alpha;
grant select, insert, update, delete on table public.menu to alpha;
grant select, insert, update, delete on all tables in schema public to alpha;
revoke all privileges on all tables in schema public from alpha;
grant all privileges on all tables in schema public to alpha;
ดาวน์โหลด saturn database (saturn.tar) ได้ที่ ► http://bit.ly/2E2uY7a
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs
สอน PostgreSQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGi_NqmIu43B-PsxA0wtnyH
สอน MySQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GFmJDsZipFCrY6L-0RrBYLT
สอน Microsoft SQL Server 2012, 2014, 2016, 2017 ► https://www.youtube.com/playlist?list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
สอน SQLite ► https://www.youtube.com/playlist?list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
สอน SQL สำหรับ Data Science ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGq8M6HO8xrpkaRhvEBsQhw
การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python ► https://www.youtube.com/playlist?list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access) ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
#prasertcbs_SQL #prasertcbs #prasertcbs_PostgreSQL
![post-title](https://i.ytimg.com/vi/xWg2mHa8oDg/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBc87oxnlMrSH-10wDf6NYn0_PMYQ)
mysql delete table 在 prasertcbs Youtube 的精選貼文
เนื้อหาหลักประกอบด้วย
1. การสร้าง Database diagram
2. การสร้าง referential integrity ระหว่างตาราง
3. การกำหนดให้มีการทำ cascade update
4. การกำหนดให้มีการทำ cascade delete
ดาวน์โหลดฐานข้อมูล Yummi2014 ได้ที่ http://goo.gl/elJ64i
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs
สอน Microsoft SQL Server 2012, 2014, 2016, 2017 ► https://www.youtube.com/playlist?list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
สอน PostgreSQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGi_NqmIu43B-PsxA0wtnyH
สอน MySQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GFmJDsZipFCrY6L-0RrBYLT
สอน SQLite ► https://www.youtube.com/playlist?list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access) ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python ► https://www.youtube.com/playlist?list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
#prasertcbs_SQL #prasertcbs #prasertcbs_mssql
![post-title](https://i.ytimg.com/vi/lpDdvO6SvgQ/hqdefault.jpg)
mysql delete table 在 MySQL: DELETE didn't shrink DB size, nor table size 的推薦與評價
There is no auto cleanup of fragmentation on deleting table rows from an InnoDB table.. You have to defragment the table manually. METHOD #1. ... <看更多>
mysql delete table 在 How to Delete Table from MySQL Database - YouTube 的推薦與評價
... <看更多>