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
				

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM