SQL server进阶查询

这些是一些函数使用方法
先来张表

然后代码如下:
create table tb_inoutfield
(
xid float,
xname nvarchar(255),
xtype nvarchar(255)
);
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (1, N'工资', N'收入');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (2, N'奖金', N'收入');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (3, N'分红', N'收入');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (4, N'送礼', N'支出');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (5, N'坐车', N'支出');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (6, N'伙食', N'支出');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (7, N'电话费', N'支出');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (9, N'穿衣', N'支出');
INSERT INTO tb_inoutfield (xid, xname, xtype) VALUES (10, N'旅游', N'支出');
--查询收支项目表
select * from Tb_InOutField
如下图所展示

查询所有梁姓家庭成员
select * from Tb_Users where left(uname,1)='梁'
如下图所示


浙公网安备 33010602011771号