Get the App
SLTechnology News&Howtos  ›  Database  › 

Use cases for annotations in MySQL

Shulou Source: shulou.com Published: 2022-05-31 22:45:46 10月02日 Update

This article mainly introduces the use cases of annotations in MySQL, which is very detailed and has certain reference value. Friends who are interested must finish it!

Each language has its own way of annotating, and the more code there is, the more important it is. In general, comments can appear anywhere in the program to prompt or explain the function and function of the program to the user or programmer. This article focuses on the comments in MySQL.

1. Field comment

Create table test1 (id int primary key comment 'user_id')

two。 Table comments

Create table test2 (id int primary key,name varchar (20) not null) comment='table_comment'

3. Single-line comment

A) A single-line comment can be made with a # comment character, which is followed by a comment directly. The format is as follows:

Create table test3 (id int primary key,name varchar (20) not null# pair is just a single-line attribute)

B) single-line comments can use-- comment characters,-- need to add a space after the comment character before the comment can take effect. The format is as follows:

Create table test4 (id int primary key,name varchar (20) not null-- one-line attribute school varchar (20) not null-- I am a-- (wrong comment because-- there is no space after it))

4. Multiline comment

Create table test5 (id int primary key,name varchar (30) not null/*) is so big that it can't be stewed for thousands of miles, so there is a heavenly eye * /). The above is all the content of this article, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Comments content attributes programs cases codes formats articles importance value location role interest function just Heavenly Eye Fields guys Partners situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple NVidia Shulou Tech Info Microsoft Docker