Oracle、Mysql、SqlServer创建表和给表和字段加注释

一、Oracle

--创建表
create table test ( 
	 id varchar2(200) primary key not null,
	 sort number, 
	 name varchar(200)
)
--字段加注释
comment on column test.id is 'id'; 
comment on column test.sort is '序号';
--表加注释
comment on table test is '测试表'

 二.Mysql

--创建表
create table test ( 
	 id varchar(200) not null,
	 sort int(11) comment '排序',
	 name varchar(200) comment  '名称',
)			
--表加注释
alter table test comment ='测试表'

三.SqlServer

--创建表
create table test ( 
	 id varchar(200) primary key not null,
	 sort int,
	 name varchar(200),
)

--给字段加注释
EXEC sp_addextendedproperty N'test', N'序号', N'user', N'dbo', N'table', N'test', N'column', N'sort';
				
--表加注释
EXECUTE sp_addextendedproperty N'test', N'测试表', N'user', N'dbo',N'table', N'test', NULL, NULL
				
原文地址:https://www.cnblogs.com/zt528/p/5386516.html