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
86
|
QUERY: create table person (name text, age int4, location point);
QUERY: create table man () inherits(person);
QUERY: create table emp (salary int4, manager char16) inherits(person);
QUERY: create table student (gpa float8) inherits (person);
QUERY: create table stud_emp (percent int4) inherits (emp, student);
QUERY: create table female_stud_emp () inherits(stud_emp);
QUERY: select * from person;
name age location
----- ---- ---------
QUERY: select * from man;
name age location
----- ---- ---------
QUERY: select * from emp;
name age location salary manager
----- ---- --------- ------- --------
QUERY: select * from student;
name age location gpa
----- ---- --------- ----
QUERY: select * from stud_emp;
name age location salary manager gpa percent
----- ---- --------- ------- -------- ---- --------
QUERY: select * from female_stud_emp;
name age location salary manager gpa percent
----- ---- --------- ------- -------- ---- --------
QUERY: insert into person values ('andy', 14, '(1,1)');
QUERY: insert into emp values ('betty', 20, '(2, 1)', 1000, 'mandy');
QUERY: insert into student values ('cy', 45, '(3, 2)', 1.9);
QUERY: insert into stud_emp values ('danny', 19, '(3.3, 4.55)', 400, 'mandy', 3.9);
QUERY: insert into man values ('fred', 2, '(0, 0)');
QUERY: insert into female_stud_emp values ('gina', 16, '(10, 10)', 500, 'mandy', 3.0);
QUERY: select * from person;
name age location
----- ---- ---------
andy 14 (1,1)
QUERY: select * from emp;
name age location salary manager
------ ---- --------- ------- --------
betty 20 (2,1) 1000 mandy
QUERY: select * from student;
name age location gpa
----- ---- --------- ----
cy 45 (3,2) 1.9
QUERY: select * from stud_emp;
name age location salary manager gpa percent
------ ---- ----------- ------- -------- ---- --------
danny 19 (3.3,4.55) 400 mandy 3.9
QUERY: select * from man;
name age location
----- ---- ---------
fred 2 (0,0)
QUERY: select * from female_stud_emp;
name age location salary manager gpa percent
----- ---- --------- ------- -------- ---- --------
gina 16 (10,10) 500 mandy 3
QUERY: select * from person*;
name age location
------ ---- -----------
andy 14 (1,1)
fred 2 (0,0)
betty 20 (2,1)
cy 45 (3,2)
danny 19 (3.3,4.55)
gina 16 (10,10)
QUERY: select * from emp*;
name age location salary manager
------ ---- ----------- ------- --------
betty 20 (2,1) 1000 mandy
danny 19 (3.3,4.55) 400 mandy
gina 16 (10,10) 500 mandy
QUERY: select * from student*;
name age location gpa
------ ---- ----------- ----
cy 45 (3,2) 1.9
danny 19 (3.3,4.55) 3.9
gina 16 (10,10) 3
QUERY: select * from stud_emp*;
name age location salary manager gpa percent
------ ---- ----------- ------- -------- ---- --------
danny 19 (3.3,4.55) 400 mandy 3.9
gina 16 (10,10) 500 mandy 3
QUERY: drop table female_stud_emp;
QUERY: drop table stud_emp;
QUERY: drop table student;
QUERY: drop table emp;
QUERY: drop table man;
QUERY: drop table person;
|