🔥 และในวันนี้ แอดจะพาเพื่อน ๆ มาทำความรู้จักกับอีกหนึ่งคำสั่งเจ๋ง ๆ ใน 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 - 🦖 สร้างการเรียนรู้ที่ดีสำหรับสายไอทีในทุกวัน
同時也有1部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 from table」的推薦目錄:
- 關於mysql delete from table 在 BorntoDev Facebook 的精選貼文
- 關於mysql delete from table 在 prasertcbs Youtube 的精選貼文
- 關於mysql delete from table 在 Delete all records in a table of MYSQL in phpMyAdmin - Stack ... 的評價
- 關於mysql delete from table 在 MySQL Tutorial for Beginners 16 - MySQL DELETE Query 的評價
- 關於mysql delete from table 在 MySQL: DELETE didn't shrink DB size, nor table size 的評價
- 關於mysql delete from table 在 MySQL delete 一次刪除指定多個資料表欄位方法 的評價
mysql delete from 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

mysql delete from 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 from table 在 Delete all records in a table of MYSQL in phpMyAdmin - Stack ... 的推薦與評價
... <看更多>
相關內容