天天看点

ACCESS中各查询的功能简介、SQL语法

一、简单查询

功能:类似excel中的vlookup功能。
SQL语法:
select  target.field1,target.filed2
from  targettable
where criteria  
           

二、生成表查询

功能:生成新表记录节点值
SQL语法:
select source.field1,source.field2
into newtable
from sorcetable
           

三、更新查询

功能:相当于excel中的Ctrl+T的替换功能
SQL语法:
update table
set newvalue
where criteria
           

四、追加查询

功能:插入新记录
SQL语法:(插入多个记录)
insert into target.field1,target.field2
select from source.field1,source.field2
from sorcetable
           
SQL语法:(插入一个记录)
insert into target.field1,target.field2
values value1,value2
           

五、删除查询

功能:删除记录
SQL语法:
delete target.field1,target.field2
from targettable
where criteria
           

六、交叉表查询

功能:类似excel中的数据透视表功能
SQL语法:
transfrom aggfuntion
selectstatment
from table
pivot pivotfield in value1,value2
           

PS:从excel使用习惯中切到access,总感觉有很多不习惯,强制使用两天后基本就熟练,为了加深印象写下来自己的理解,如有不正确的地方敬请指正。