百科问答

百科问答 国内资讯 公司资讯 政策法规 培训资料 产品下载

用友软件几个基本SQL语句:选择、插入、删除、更新、查找、排序、总数、求和、平均、最大、最小常用语句

发布时间:2024-11-18 

特价活动:>>>> 用友U8、T6、T+、T3软件产品4折优惠,畅捷通T+cloud、好会计、好业财、好生意云产品8折优惠,另有话费赠送。

 

1.选择:

select * from table1 where 范围
注:table1是表名。
例如,在users1这份表中挑选出id小于40的内容:
select * from users1 where id<40
*号不要忘了噢


2.插入:

insert into table1(field1,field2) values(value1,value2)
注:field1,field2是列名,value1,value2是某一行的项目内容。
例如,在users1这份表中加入编号为87的林熙:
insert into users1(id,name) values(87,'林熙')
注意:由于要插入的名字是字符串,所以要加入单引号('')来表示这不是列名。

3.删除:

delete from table1 where 范围
例如,将id>86的项目从users1这张表中删除:
delete from users1 where id>86


4.更新:

update table1 set field1=value1 where 范围
例如,将users1这张表中id为1的name改成梦姚:
update users1 set name='梦姚' where id=1


5.查找:

select * from table1 where field1 like '%value1%'
例如,从users1这张表中找到name为“旻菲”的项目:
select * from users1 where name like '%旻菲%'
*号不要忘了噢


6.排序:

select * from table1 order by field1,field2 desc
注:
desc表示按降序排列。
例如,在users1这张表中将id、name按降序排列:
select * from users1 order by id,name desc
*号不要忘了噢


7.总数:

select count as totalcount from table1
注:
count是列名。
例如,在users1中根据id来进行数量统计:
select id as totalcount from users1


8.求和:

select sum(field1) as sumvalue from table1
注:
此处field1必须为数值。
例如,在users1中,计算num这一列的数值总和:

select sum(num) as sumvalue from users1


9.平均:

select avg(field1) as avgvalue from table1
注:
此处field1必须为数值。
例如,在users1中,计算num这一列的平均值:

select avg(num) as avgvalue from users1

10.最大:

select max(field1) as maxvalue from table1
注:
此处field1必须为数值。
例如,在users1中,计算num这一列的最大值:
select max(num) as maxvalue from users1

11.最小:

select min(field1) as minvalue from table1
注:
此处field1必须为数值。
例如,在users1中,计算num这一列的最小值:
select min(id) as minvalue from users1

X畅捷通软件.用友软件.企业云服务

截屏,微信识别二维码

客服QQ:5151867

(点击QQ号复制,添加好友)