sql中的保留字

sql中的保留字  

user是数据库保留字段,需要用[]起来,这是规定

下面的sql是指数据库语句,如select * from [user],而不是数据库的意思,所以和access没太大关系

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    

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

SQL常用命令使用方法:  

(1) 数据记录筛选:   

sql="select * from 数据表 where 字段名=字段值 order by 字段名 "   

sql="select * from 数据表 where 字段名 like ‘%字段值%‘ order by 字段名 "   

sql="select top 10 * from 数据表 where 字段名 order by 字段名 "   

sql="select * from 数据表 where 字段名 in (‘值1‘,‘值2‘,‘值3‘)"   

sql="select * from 数据表 where 字段名 between 值1 and 值2"   

(2) 更新数据记录:   

sql="update 数据表 set 字段名=字段值 where 条件表达式"   

sql="update 数据表 set 字段1=值1,字段2=值2 …… 字段n=值n where 条件表达式"   

(3) 删除数据记录:   

sql="delete from 数据表 where 条件表达式"   

sql="delete from 数据表" (将数据表所有记录删除)   

(4) 添加数据记录:   

sql="insert into 数据表 (字段1,字段2,字段3 …) valuess (值1,值2,值3 …)"   

sql="insert into 目标数据表 select * from 源数据表" (把源数据表的记录添加到目标数据表)   

(5) 数据记录统计函数:   

AVG(字段名) 得出一个表格栏平均值

COUNT(*|字段名) 对数据行数的统计或对某一栏有值的数据行数统计

MAX(字段名) 取得一个表格栏最大的值

MIN(字段名) 取得一个表格栏最小的值

SUM(字段名) 把数据栏的值相加   

引用以上函数的方法:   

sql="select sum(字段名) as 别名 from 数据表 where 条件表达式"

set rs=conn.excute(sql)   

用 rs("别名") 获取统的计值,其它函数运用同上。   

(5) 数据表的建立和删除:   

CREATE TABLE 数据表名称(字段1 类型1(长度),字段2 类型2(长度) …… )   

例:CREATE TABLE tab01(name varchar(50),datetime default now())   

DROP TABLE 数据表名称 (永久性删除一个数据表)   

(6) 表结构的修改和新增:

ALTER TABLE   表名  ALTER COLUMN 已有字段名  更改后的类型 --更改已有字段

ALTER TABLE   表名   ADD column_b VARCHAR(20) NULL --新增字段

ALTER TABLE   表名  DROP COLUMN column_b --删除字段

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

4. 记录集对象的方法:   

rs.movenext 将记录指针从当前的位置向下移一行

rs.moveprevious 将记录指针从当前的位置向上移一行

rs.movefirst 将记录指针移到数据表第一行

rs.movelast 将记录指针移到数据表最后一行

rs.absoluteposition=N 将记录指针移到数据表第N行

rs.absolutepage=N 将记录指针移到第N页的第一行

rs.pagesize=N 设置每页为N条记录

rs.pagecount 根据 pagesize 的设置返回总页数

rs.recordcount 返回记录总数

rs.bof 返回记录指针是否超出数据表首端,true表示是,false为否

rs.eof 返回记录指针是否超出数据表末端,true表示是,false为否

rs.delete 删除当前记录,但记录指针不会向下移动

rs.addnew 添加记录到数据表末端

rs.update 更新数据表记录   

判断所填数据是数字型  

if not isNumeric(request("字段名称")) then

response.write "不是数字"

else

response.write "数字"

end if  

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值