常用 SQL 语句大全

发表于:2007-10-15 16:40

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:网络转载

分享:

----系统函数----

  APP_NAME() --函数返回当前执行的应用程序的名称

  COALESCE() --函数返回众多表达式中第一个非NULL 表达式的值

  COL_LENGTH(<'table_name'>, <'column_name'>) --函数返回表中指定字段的长度值

  COL_NAME(, ) --函数返回表中指定字段的名称即列名

  DATALENGTH() --函数返回数据表达式的数据的实际长度

  DB_ID(['database_name']) --函数返回数据库的编号

  DB_NAME(database_id) --函数返回数据库的名称

  HOST_ID() --函数返回服务器端计算机的名称

  HOST_NAME() --函数返回服务器端计算机的名称

  IDENTITY([, seed increment]) [AS column_name])

  --IDENTITY() 函数只在SELECT INTO 语句中使用用于插入一个identity column列到新表中 

/*select identity(int, 1, 1) as column_name
  into newtable
  from oldtable*/


  ISDATE() --函数判断所给定的表达式是否为合理日期

  ISNULL(, ) --函数将表达式中的NULL 值用指定值替换

  ISNUMERIC() --函数判断所给定的表达式是否为合理的数值

  NEWID() --函数返回一个UNIQUEIDENTIFIER 类型的数值

  NULLIF(, )

  --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

 

66/6<123456
重磅发布,2022软件测试行业现状调查报告~

精彩评论

  • xiaoyu2006
    2007-11-08 17:37:26

    不错,有指导作用,多谢

  • qicyt1812
    2007-10-29 17:35:03

    数据库想了解很简单,但是想深入学习就比较难咯,不过如果做测试的话基本了解就可以了,要求不是很高。如果想做DBA那就要付出更多的努力才行。

  • vivuzhan
    2007-10-25 11:49:13

    因為沒有深入學過數據庫,所以想問問數據庫很難嘛?  
    如果學,該如何入手,有比較好的辦法嘛??? 請指點. tks

  • wangkai
    2007-10-24 17:29:16

    很好,非常需要

  • lzc8800
    2007-10-17 10:13:01

    Not bad!
    Thanks

  • 李凡123
    2007-10-17 02:33:20

    很好
       能不能多发点啊

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2023
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号