设为首页 加入收藏

TOP

高级SQL基础查询(三)
2017-10-22 06:06:51 】 浏览:409
Tags:高级 SQL 基础 查询
and(50), rand();

select round(rand(), 3), round(rand(100), 5);

select round(123.456, 2), round(254.124, -2);

select round(123.4567, 1, 2);

– 元数据

select col_name(object_id(‘student’), 1); // 返回列名

select col_name(object_id(‘student’), 2);

– 该列数据类型长度

select col_length(‘student’, col_name(object_id(‘student’), 2));

– 该列数据类型长度

select col_length(‘student’, col_name(object_id(‘student’), 1));

– 返回类型名称、类型id

select type_name(type_id(‘varchar’)), type_id(‘varchar’);

– 返回列类型长度

select columnProperty(object_id(‘student’), ‘name’, ‘PRECISION’);

– 返回列所在索引位置

select columnProperty(object_id(‘student’), ‘sex’, ‘ColumnId’);

– 字符串函数

select ascii('a');

select ascii('A');

select char(97);

select char(65);

select nchar(65);

select nchar(45231);

select nchar(32993);

select unicode('A'), unicode('中');

select soundex('hello'), soundex('world'), soundex('word');

select patindex('%a', 'ta'), patindex('%ac%', 'jack'), patindex('dex%', 'dexjack');

select 'a' + space(2) + 'b', 'c' + space(5) + 'd';

select charIndex('o', 'hello world');

select charIndex('o', 'hello world', 6);

select quoteName('abc[]def'), quoteName('123]45');

select str(123.456, 2), str(123.456, 3), str(123.456, 4);

select str(123.456, 9, 2), str(123.456, 9, 3), str(123.456, 6, 1), str(123.456, 9, 6);

select difference('hello', 'helloWorld');

select difference('hello', 'world');

select difference('hello', 'llo');

select difference('hello', 'hel');

select difference('hello', 'hello');

select replace('abcedef', 'e', 'E');

select stuff('hello world', 3, 4, 'ABC');

select replicate('abc#', 3);

select subString('abc', 1, 1), subString('abc', 1, 2), subString('hello Wrold', 7, 5);

select len('abc');

select reverse('sqlServer'); 

select left('leftString', 4);

select left('leftString', 7);

select right('leftString', 6);

select right('leftString', 3);

select lower('aBc'), lower('ABC');

select upper('aBc'), upper('abc');

select ltrim(' abc'), ltrim('# abc#'), ltrim('  abc');

select rtrim(' abc    '), rtrim('# abc#   '), rtrim('abc');
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇用hibernate5进行查询时获取单个.. 下一篇Eclipse中堆内存的设置遇到的问题

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目