How to add fields and comments to a table in sql

How to add fields and comments to a table in sql

1. Add fields:

alter table table name ADD field name type;

eg:

alter table sys_cwzd ADD SCCLLJ VARCHAR2(50);

2. Add remarks:

comment on column table name. Field name is 'remark name';

eg:

comment on column sys_cwzd.SCCLLJ is 'Upload material path';

Content extension:

Add a new field:

alter table bulletin add citycode varchar(6) not null default 0; # city code

1. Set the encoding when creating the database

create database test character set utf8;

2. Set the encoding when creating a table

create table test(id int primary key)DEFAULT charset=utf8;

3. Modify the database encoding

alter database test character set utf8;

4. Modify the default encoding of the table

alter table test character set utf8;

You may also be interested in:
  • Several ways to add timestamps in MySQL tables
  • How to add indexes to MySQL
  • MYSQL implements sample code to prevent duplicate addition when adding shopping cart
  • How to create a stored procedure in MySQL and add records in a loop
  • Summary of MySQL's commonly used SQL statements for creating tables, adding fields, modifying fields, and adding indexes

<<:  Detailed explanation of Vue's methods and properties

>>:  CentOS 6 uses Docker to deploy Zookeeper operation example

Recommend

Vue project realizes paging effect

The paging effect is implemented in the vue proje...

Detailed explanation of chmod command usage in Linux

chmod Command Syntax This is the correct syntax w...

Solution to slow response of Tomcat server

1. Analytical thinking 1. Eliminate the machine&#...

Problems encountered in the execution order of AND and OR in SQL statements

question I encountered a problem when writing dat...

Problems and solutions when installing MySQL8.0.13 on Win10 system

Operating system: Window10 MySQL version: 8.0.13-...

MySQL 5.7.23 decompression version installation tutorial with pictures and text

It is too troublesome to find the installation tu...

How to check whether a port is occupied in LINUX

I have never been able to figure out whether the ...

What to do if the container started by docker run hangs and loses data

Scenario Description In a certain system, the fun...

Native js to achieve accordion effect

In actual web page development, accordions also a...

Set the width of the table to be fixed so that it does not change with the text

After setting the table width in the page to width...

A very detailed summary of communication between Vue components

Table of contents Preface 1. Props, $emit one-way...

How many pixels should a web page be designed in?

Many web designers are confused about the width of...

MySQL statement summary

Table of contents 1. Select database USE 2. Displ...