sql Method for adding fields and notes to a table

  • 2021-12-11 19:17:20
  • OfStack

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 ' Note 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 encoding when you create a database


create database test character set utf8;

2. Set encoding when creating tables


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

3. Modify the database coding


alter database test character set utf8;

4. Modify the table default encoding


alter table test character set utf8;


Related articles: