1.添加字段: alter table 表名 add (字段 字段类型) [ default '输入默认值'] [null/not null] ; 2.添加备注: comment on column 库名.表名.字段名 is '输入的备注'; 如: 我要在ers_data库中 test表 document_type字段添加备注 comment on column ers_data.test.document_type is '文件类型'; 3.修改字段类型: alter t
1. select a.* from ALL_TAB_COMMENTS a --查表名和表中文名select a.* from ALL_TAB_COLUMNS a --查询表字段属性select a.* from ALL_COL_COMMENTS a --查询表字段名称 2. dba_tables.all_tables和user_tables的区别 dba_tables : 系统里所有的表的信息,需要DBA权限才能查询all_tables : 当前用户有权限的表的信息(只要对某个表有任何权限,
1.查找单个字段 select 字段名,count(*) from table group by 字段名 having count(*) > 1 2.查找组合字段: SELECT TEST_NAME1,TEST_NAME2,COUNT(*) FROM table GROUP BY TEST_NAME1,TEST_NAME2 HAVING COUNT(*) > 1
-- SQL Server 2008 SELECT 表名 = d.name, 表说明 = case when a.colorder=1 then isnull(f.value,'') else '' end, 字段序号 = a.colorder, 字段名 = a.name, 标识 = case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end, 主键 = case when exists(SELECT 1 F
直切正题 1.表tb中字段num最大的数据 {pc:get $sql="select * from tb where num=(select MAX(num) from tb)"}****************{/pc} 2.表tb中字段num不重复的数据,并按照num从大到小排序 {pc:get $sql="select distinct num from tb order by num desc"}***********{/pc} 用到这个主要是,我的需求添加
[1]MySQL中查询某表中字段的数据类型 (1)DESC 表名: (2)DESCRIBE 表名: (3)SHOW COLUMNS FROM 表名: 应用示例: DESC cfg_acct_free_res; DESCRIBE cfg_acct_free_res; SHOW COLUMNS FROM cfg_acct_free_res; Good Good Study, Day Day Up. 顺序 选择 循环 总结
--添加空间字段 , ); --根据其他字段更新空间字段数据 update "GIS" b ) from "GIS" a where b."ID"=a."ID" --创建索引 CREATE INDEX shape_index_sz1 ON "GIS" USING gist (四至); --查询与指定范围相交的多边形 SELECT * FROM "GIS" where ST_Interse
查看表字段.类型.注释 SELECT A.COLUMN_NAME,B.comments,A.DATA_TYPE FROM USER_TAB_COLUMNS A LEFT JOIN user_col_comments B ON A.TABLE_NAME=B.table_name AND A.COLUMN_NAME=B.column_name WHERE A.TABLE_NAME = '表名' ORDER BY A.COLUMN_ID; 获取表字段 select * from user_tab_co
select b.name from dbo.syscomments a, dbo.sysobjects b where a.id=b.id and b.xtype='p' and a.text like '%@tempGoods%' order by name xtype 代表类型 C = CHECK 约束D = 默认值或 DEFAULT 约束F = FOREIGN KEY 约束L = 日志FN = 标量函数IF = 内嵌表函数P = 存储过程PK = PRIMARY KEY 约束(类型是
--数据库中所有表的信息(很强悍的) SELECT 表名 = CASE WHEN A.COLORDER=1 THEN D.NAME ELSE ' ' END, 表說明 = CASE WHEN A.COLORDER=1 THEN ISNULL(F.VALUE, ' ') ELSE ' ' END, 欄位序號 = A.COLORDER, 欄位名
SELECT TOP (500) ID, Personname, Personcode, Telphone, Fraction into temp3 FROM Records AS a WHERE (LEN(Personcode) = 18 OR LEN(Personcode) = 15) AND (NOT EXISTS (SELECT 1 AS Expr1 FROM Records WHERE (Personname = a.Personname) AND (Fraction > a.Frac
create procedure proc_view_cloumns ( ) ) AS select b.name,a.value,c.name, b.max_length from sys.extended_properties a, sys.columns b,sys.types c where a.major_id = OBJECT_ID(@tableName) and a.major_id = b.object_id and a.minor_id = b.column_id and b.