当前位置:Gxlcms > mysql > 你可能不知道的MySQL_MySQL

你可能不知道的MySQL_MySQL

时间:2021-07-01 10:21:17 帮助过:22人阅读

  mysql> desc tbl_name;

  +-------+--------------+------+-----+---------+-------+

  | Field | Type | Null | Key | Default | Extra |

  +-------+--------------+------+-----+---------+-------+

  | uid | int(11) | NO | | NULL | |

  | sid | mediumint(9) | NO | | NULL | |

  | times | mediumint(9) | NO | | NULL | |

  +-------+--------------+------+-----+---------+-------+

  3 rows in set (0.00 sec)

  存储引擎是MyISAM,里面有10,000条数据。

  一、“\G”的作用

  mysql> select * from tbl_name limit 1;

  +--------+--------+-------+

  | uid | sid | times |

  +--------+--------+-------+

  | 104460 | 291250 | 29 |

  +--------+--------+-------+

  1 row in set (0.00 sec)

  mysql> select * from tbl_name limit 1\G;

  *************************** 1. row ***************************

  uid: 104460

  sid: 291250

  times: 29

  1 row in set (0.00 sec)有时候,操作返回的列数非常多,屏幕不能一行显示完,显示折行,试试”\G”,把列数据逐行显示(”\G”挽救了我,以前看explain语句横向显示不全折行看起来巨费劲,还要把数据和列对应起来)。

人气教程排行