-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsqldb.txt
85 lines (60 loc) · 1.69 KB
/
sqldb.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
create table pinfo
(
ref_id integer primary key not null,
name varchar(255),
fname varchar(255),
dob date,
sex varchar(10),
address varchar(255)
);
insert into pinfo values(0,'a','b','12-12-12','male','8-f,street-32,sector 15');
create table electricity_bill
(
ref_id integer primary key not null,
status varchar(20),
amount integer
);
insert into electricity_bill values(0,'paid',2300);
create table township_house_bill
(
ref_id integer primary key not null,
status varchar(20),
amount integer
);
insert into township_house_bill values(0,'paid',2300);
create table water_bill
(
ref_id integer primary key not null,
status varchar(20),
amount integer
);
insert into water_bill values(0,'paid',2300);
create table hospital_bill
(
ref_id integer primary key not null,
status varchar(20),
amount integer
);
insert into hospital_bill values(0,'paid',2300);
create table gas_bill
(
ref_id integer primary key not null,
status varchar(20),
amount integer
);
insert into gas_bill values(0,'paid',2300);
select 'electricity' as BILLTYPE,e.status as STATUS,e.amount as AMOUNT
from electricity_bill e,pinfo p
where e.ref_id = p.ref_id;
select 'township' as BILLTYPE,e.status as STATUS,e.amount as AMOUNT
from township_house_bill e,pinfo p
where e.ref_id = p.ref_id;
select 'water' as BILLTYPE,e.status as STATUS,e.amount as AMOUNT
from water_bill e,pinfo p
where e.ref_id = p.ref_id;
select 'hospital' as BILLTYPE,e.status as STATUS,e.amount as AMOUNT
from hospital_bill e,pinfo p
where e.ref_id = p.ref_id;
select 'gas' as BILLTYPE,e.status as STATUS,e.amount as AMOUNT
from gas_bill e,pinfo p
where e.ref_id = p.ref_id;