解释mysql中的Vs Desc异常

Use*_*034 7 mysql describe sql-execution-plan

MySQL中的EXPLAIN和DESC命令有什么区别?

Kon*_*rak 10

  • Explain将为您提供有关查询的更多信息,
  • describe将为您提供有关表或列的更多信息.

您还可以对表名使用EXPLAIN,在这种情况下,它的行为与DESCRIBE完全相同.

EXPLAIN SELECT * 
FROM `customer`

id  select_type  table  type  possible_keys  key  key_len  ref  rows  Extra 
1 SIMPLE customer ALL NULL NULL NULL NULL 2 
Run Code Online (Sandbox Code Playgroud)

DESCRIBE `customer`
Field  Type  Null  Key  Default  Extra 
CustomerID varchar(2) NO      
Cx varchar(3) NO   
Run Code Online (Sandbox Code Playgroud)