[英]SQL Get the column names from a table as data?
I have Table name Employees like; 我有表名员工喜欢;
Emp_Id Emp_Name Emp_Grade Emp_Mobile
I want to return the column names as data how i can do this via query? 我想将列名作为数据返回,如何通过查询做到这一点?
Hi, 你好
You can use below query to get the column names, 您可以使用以下查询获取列名,
SELECT COLUMN_NAME FROM COLS WHERE TABLE_NAME = 'your_table_name';
Provide table name in the WHERE condition 在WHERE条件下提供表名
You can also describe table to know their constraints, data type and length using, 您还可以使用以下方式描述表,以了解其约束条件,数据类型和长度:
DESC your_table_name;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.