当前位置: 移动技术网 > IT编程>数据库>MSSQL > SQL命令大全-中英文对照第1/3页

SQL命令大全-中英文对照第1/3页

2017年12月12日  | 移动技术网IT编程  | 我要评论

淡泊坊,大连铁通影院,禅悦瑜伽


quotename() --函数返回被特定字符括起来的字符串
/*select quotename('abc', '{') quotename('abc')
运行结果如下
----------------------------------{
{abc} [abc]*/

replicate() --函数返回一个重复character_expression 指定次数的字符串
/*select replicate('abc', 3) replicate( 'abc', -2)
运行结果如下
----------- -----------
abcabcabc null*/

reverse() --函数将指定的字符串的字符排列顺序颠倒
replace() --函数返回被替换了指定子串的字符串
/*select replace('abc123g', '123', 'def')
运行结果如下
----------- -----------
abcdefg*/

space() --函数返回一个有指定长度的空白字符串
stuff() --函数用另一子串替换字符串指定位置长度的子串


----数据类型转换函数----
cast() 函数语法如下
cast() (<expression> as <data_ type>[ length ])
convert() 函数语法如下
convert() (<data_ type>[ length ], <expression> [, style])

select cast(100+99 as char) convert(varchar(12), getdate())
运行结果如下
------------------------------ ------------
199 jan 15 2000

----日期函数----
day() --函数返回date_expression 中的日期值
month() --函数返回date_expression 中的月份值
year() --函数返回date_expression 中的年份值
dateadd(<datepart> ,<number> ,<date>) 
--函数返回指定日期date 加上指定的额外日期间隔number 产生的新日期
datediff(<datepart> ,<number> ,<date>)
--函数返回两个指定日期在datepart 方面的不同之处
datename(<datepart> , <date>) --函数以字符串的形式返回日期的指定部分
datepart(<datepart> , <date>) --函数以整数值的形式返回日期的指定部分
getdate() --函数以datetime 的缺省格式返回系统当前的日期和时间

----系统函数----
app_name() --函数返回当前执行的应用程序的名称
coalesce() --函数返回众多表达式中第一个非null 表达式的值
col_length(<'table_name'>, <'column_name'>) --函数返回表中指定字段的长度值
col_name(<table_id>, <column_id>) --函数返回表中指定字段的名称即列名
datalength() --函数返回数据表达式的数据的实际长度
db_id(['database_name']) --函数返回数据库的编号
db_name(database_id) --函数返回数据库的名称
host_id() --函数返回服务器端计算机的名称
host_name() --函数返回服务器端计算机的名称
identity(<data_type>[, seed increment]) [as column_name])
--identity() 函数只在select into 语句中使用用于插入一个identity column列到新表中
/*select identity(int, 1, 1) as column_name
into newtable
from oldtable*/
isdate() --函数判断所给定的表达式是否为合理日期
isnull(<check_expression>, <replacement_value>) --函数将表达式中的null 值用指定值替换
isnumeric() --函数判断所给定的表达式是否为合理的数值
newid() --函数返回一个uniqueidentifier 类型的数值
nullif(<expression1>, <expression2>)
--nullif 函数在expression1 与expression2 相等时返回null 值若不相等时则返回expression1 的值



--------------------------------------------------------------------------------

sql中的保留字

action add aggregate all 
alter after and as 
asc avg avg_row_length auto_increment 
between bigint bit binary 
blob bool both by 
cascade case char character 
change check checksum column 
columns comment constraint create 
cross current_date current_time current_timestamp 
data database databases date 
datetime day day_hour day_minute 
day_second dayofmonth dayofweek dayofyear 
dec decimal default delayed 
delay_key_write delete desc describe 
distinct distinctrow double drop 
end else escape escaped 
enclosed enum explain exists 
fields file first float 
float4 float8 flush foreign 
from for full function 
global grant grants group 
having heap high_priority hour 
hour_minute hour_second hosts identified 
ignore in index infile 
inner insert insert_id int 
integer interval int1 int2 
int3 int4 int8 into 
if is isam join 
key keys kill last_insert_id 
leading left length like 
lines limit load local 
lock logs long longblob 
longtext low_priority max max_rows 
match mediumblob mediumtext mediumint 
middleint min_rows minute minute_second 
modify month monthname myisam 
natural numeric no not 
null on optimize option 
optionally or order outer 
outfile pack_keys partial password 
precision primary procedure process 
processlist privileges read real 
references reload regexp rename 
replace restrict returns revoke 
rlike row rows second 
select set show shutdown 
smallint soname sql_big_tables sql_big_selects 
sql_low_priority_updates sql_log_off sql_log_update sql_select_limit 
sql_small_result sql_big_result sql_warnings straight_join 
starting status string table 
tables temporary terminated text 
then time timestamp tinyblob 
tinytext tinyint trailing to 
type use using unique 
unlock unsigned update usage 
values varchar variables varying 
varbinary with write when 
where year year_month zerofill  







3

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网