sqLite 实例
insert into payIncome(time,inout,money,type) values("2014-05-12","支出",25.5,"衣服"); insert into payIncome(time,35.5,"饮食"); insert into payIncome(time,"收入",135.5,"打工"); insert into payIncome(time,245.5,"工资"); insert into payIncome(time,type) values("2013-05-12",3245.5,"奖金"); insert into payIncome(time,type) values("2014-04-12",500,"学费"); .mode column .mode list .mode line select * from payIncome; IDtime inout money type content -------------------- ---------- -------------------- ---------- 12014-05-12 支出 25.5 衣服 22014-05-12 支出 35.5 饮食 32014-05-12 收入 135.5 打工 42014-05-12 收入 245.5 工资 52013-05-12 收入 3245.5 奖金 62014-04-12 支出 500 学费 select inout,type,sum(money) as money frompayIncome where time like "2014-05%" group by inout,type having sum(money) >100 order by sum(money) desc; inouttype money -------------------- ---------- 收入 工资 245.5 收入 打工 135.5 select inout,sum(money) as money frompayIncome group by inout,type having sum(money) > 100 order by sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 select inout,sum(money) as money frompayIncome group by type,inout having sum(money) > 100 order by sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 select inout,sum(money) as money frompayIncome group by type,inout order b y sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 sqlite> select inout,sum(money) asmoney from payIncome group by type,inout order by sum(money) desc,inout; select inout,inout order b y sum(money) desc,inout; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 select inout,inout desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 delete from payIncome where money=500 andtype="学费" andinout="收入"; select inout,inout order b y sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 支出 学费 500 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 delete from payIncome where money=500 andtype="学费"; select inout,inout order b y sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 update payIncome set type="理发" where money=25.5 andinout="收入"; select inout,inout order b y sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 衣服 25.5 update payIncome set type="理发" where money=25.5 andinout="支出"; select inout,inout order b y sum(money) desc; inouttype money -------------------- ---------- 收入 奖金 3245.5 收入 工资 245.5 收入 打工 135.5 支出 饮食 35.5 支出 理发 25.5 create table user(id integer primary keyautoincrement,name varchar(10),pwd varc har(10)); sqlite> .tables .tables android_metadata payIncomeuser incomeItem payItem sqlite> drop table user; drop table user; sqlite> .tables .tables android_metadata incomeItem payIncome payItem sqlite> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |