当前位置:网站首页>Use of comment keyword in database
Use of comment keyword in database
2022-07-01 03:35:00 【Yi EBA】
COMMENT Introduction to the use of
effect : Add a comment to a field or column .
1. Add comments to fields when creating tables
CREATE TABLE emp(
emp_id INT PRIMARY KEY AUTO_INCREMENT COMMENT ' Number ',
emp_name CHAR(20) NOT NULL DEFAULT '' COMMENT ' full name ',
salary DECIMAL(10,2) NOT NULL DEFAULT 0 COMMENT ' Wages ',
department CHAR(20) NOT NULL DEFAULT '' COMMENT ' department '
);
2. Add comments to the fields after creating the table
ALTER TABLE emp CHANGE COLUMN department department CHAR(20) NOT NULL DEFAULT '' COMMENT ' department ';
3. View comments for all fields in the table
- The way 1
show full columns from tablename;
SHOW FULL COLUMNS FROM emp;

- The way 2
SELECT * FROM COLUMNS WHERE TABLE_SCHEMA='dbname' AND TABLE_NAME='tablename';

4. Add comments to the table when creating it
CREATE TABLE test(
field_name INT
)COMMENT=" The comment ";
5. Add comments to the table after it is created
alter table tablename comment ' Table notes ';
6. See table notes
- The way 1
show create table tablename;

- The way 2
USE information_schema;
SELECT * FROM TABLES WHERE TABLE_SCHEMA='dbname' AND TABLE_NAME='tablename';

——————END-2022-06-11——————
边栏推荐
猜你喜欢

Edge drawing: a combined real-time edge and segment detector

C#实现图的深度优先遍历--非递归代码

Introduction and installation of Solr

Asgnet paper and code interpretation 2

家居网购项目

后台系统右边内容如何出现滚动条和解决双滚动条的问题

Explain spark operation mode in detail (local+standalone+yarn)

jeecgboot输出日志,@Slf4j的使用方法

详解Spark运行模式(local+standalone+yarn)

实现pow(x,n)函数
随机推荐
Pyramid scene parsing network [pspnet] thesis reading
Pathmeasure implements loading animation
Data exchange JSON
Feature pyramid networks for object detection
E15 solution for cx5120 controlling Huichuan is620n servo error
leetcode 1482 猜猜看啊,这道题目怎么二分?
Develop industrial Internet with the technical advantages of small programs
How do spark tasks of 10W workers run? (Distributed Computing)
Design of serial port receiving data scheme
Ouc2021 autumn - Software Engineering - end of term (recall version)
gcc使用、Makefile总结
Edge drawing: a combined real-time edge and segment detector
FCN全卷積網絡理解及代碼實現(來自pytorch官方實現)
md5sum操作
Avalanche problem and the use of sentinel
终极套娃 2.0 | 云原生交付的封装
[深度学习]激活函数(Sigmoid等)、前向传播、反向传播和梯度优化;optimizer.zero_grad(), loss.backward(), optimizer.step()的作用及原理
EDLines: A real-time line segment detector with a false detection control翻译
C语言多线程编程入门学习笔记
Detailed explanation of ES6 deconstruction grammar