DELIMITER//mysql>CreateProceduretabledetails() ->BEGIN ->DESCRIBEStudent_detail; ->END//QueryOK,0rowsaffected(0.00sec)"/> DELIMITER//mysql>CreateProceduretabledetails() ->BEGIN ->DESCRIBEStudent_detail; ->END//QueryOK,0rowsaffected(0.00sec)">

Home  >  Article  >  Database  >  Create a stored procedure to get details of a specific MySQL table stored in a database?

Create a stored procedure to get details of a specific MySQL table stored in a database?

王林
王林forward
2023-08-25 15:37:021489browse

创建一个存储过程来获取数据库中存储的特定 MySQL 表的详细信息?

The following example will create a procedure called "tabledetails" that provides all the details of a specific table stored in the database.

Example

mysql> DELIMITER //
mysql> Create Procedure tabledetails()
   -> BEGIN
   -> DESCRIBE Student_detail;
   -> END //
Query OK, 0 rows affected (0.00 sec)

mysql> DELIMITER ;

mysql> CALL tabledetails;
+-------------+-------------+------+-----+---------+-------+
| Field       | Type        | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| Studentid   | int(11)     | NO   | PRI | NULL    |       |
| StudentName | varchar(20) | YES  |     | NULL    |       |
| address     | varchar(20) | YES  |     | NULL    |       |
+-------------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
Query OK, 0 rows affected (0.04 sec)

The above is the detailed content of Create a stored procedure to get details of a specific MySQL table stored in a database?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete