🔥 และในวันนี้ แอดจะพาเพื่อน ๆ มาทำความรู้จักกับอีกหนึ่งคำสั่งเจ๋ง ๆ ใน 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...
「select in mysql」的推薦目錄:
- 關於select in mysql 在 BorntoDev Facebook 的精選貼文
- 關於select in mysql 在 緯育TibaMe Facebook 的最佳貼文
- 關於select in mysql 在 prasertcbs Youtube 的精選貼文
- 關於select in mysql 在 prasertcbs Youtube 的最佳解答
- 關於select in mysql 在 SELECT WHERE field IN (subquery) - Extremely slow why? 的評價
- 關於select in mysql 在 What is the default order of records for a SELECT statement in ... 的評價
- 關於select in mysql 在 MySQL SELECT 语法总结 - Qida's Blog 的評價
select in mysql 在 緯育TibaMe Facebook 的最佳貼文
🔥學習資料庫的第一步
🔥快速活用 MySQL,精準設計關聯式資料庫
新課早鳥特惠 👉 https://bit.ly/2L9YTzn
💭你是否有過以下問題?
⚠資料太雜亂,找不到重點
⚠資訊量超出自身負荷,不知道該如何統整或分類
⚠總是花很多時間搜尋資料,卻還是一團混亂
⚠大量資訊擺在眼前,卻不懂該怎麼活用
💭10項課程目標帶你完整學會SQL
🎯運用 Workbench 工具
🎯運用 SQL 語法
🎯建立資料庫、表格、資料
🎯子查詢 - IN、ANY、ALL、EXISTS
🎯查詢資料 - SELECT、ORDER BY、WHERE 語法
🎯邏輯運算 - AND、OR、NOT、BETWEEN、IN 語法
🎯MySQL 不同函式種類與應用
🎯管理使用者帳號與如何授權
🎯關聯式資料庫觀念並進行設計
🎯MySQL 語法並進行實作
快速活用 MySQL,精準設計關聯式資料庫
早鳥特惠 👉 https://bit.ly/2L9YTzn
#Windows與MacOS皆適用
#課程中包含多個範例
#不怕學不會 #只怕你不學
select in mysql 在 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)
select in mysql 在 prasertcbs Youtube 的最佳解答
ดาวน์โหลดไฟล์ที่ใช้ในคลิปได้ที่ ► http://bit.ly/2N6mLyI
select uid, name, region, sales
from gamesales
unpivot (
sales for region in (na, eu, jp, other)
) u
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs
playlist สอน Microsoft SQL Server 2012, 2014, 2016, 2017 ► https://www.youtube.com/playlist?list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
playlist สอน SQLite ► https://www.youtube.com/playlist?list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
playlist การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access) ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
playlist การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python ► https://www.youtube.com/playlist?list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
#prasertcbs_SQL #prasertcbs
![post-title](https://i.ytimg.com/vi/ywHvP-3VbY0/hqdefault.jpg)
select in mysql 在 What is the default order of records for a SELECT statement in ... 的推薦與評價
When issuing select * from t where k = 10 with no order by clause, how does MySQL sort the records by default? Share. ... <看更多>
相關內容
select in mysql 在 MySQL SELECT 语法总结 - Qida's Blog 的推薦與評價
基础语法SELECT 基础语法如下: ... MySQL SELECT 语法总结 ... SELECT 语句可用于检索单个、多个、所有列(星号 * 通配符)。每个select_expr 表示您 ... ... <看更多>
select in mysql 在 SELECT WHERE field IN (subquery) - Extremely slow why? 的推薦與評價
... <看更多>
相關內容