1 |
-- |
2 |
-- Project: Clipping |
3 |
-- Author: Nelson Ferraz <nferraz@phperl.com> |
4 |
-- Date: 2003-08-14 |
5 |
-- |
6 |
|
7 |
|
8 |
-- |
9 |
-- VIEW: count_c_customer_by_date_created |
10 |
-- |
11 |
|
12 |
CREATE VIEW count_c_customer_by_date_created AS |
13 |
SELECT |
14 |
c_customer_date_created, |
15 |
COUNT (c_customer_id) AS count_c_customer |
16 |
FROM c_customer |
17 |
GROUP BY c_customer_date_created; |
18 |
|
19 |
|
20 |
|
21 |
-- |
22 |
-- VIEW: count_c_source_by_date_created |
23 |
-- |
24 |
|
25 |
CREATE VIEW count_c_source_by_date_created AS |
26 |
SELECT |
27 |
c_source_date_created, |
28 |
COUNT (c_source_id) AS count_c_source |
29 |
FROM c_source |
30 |
GROUP BY c_source_date_created; |
31 |
|
32 |
|
33 |
|
34 |
-- |
35 |
-- VIEW: count_c_type_by_date_created |
36 |
-- |
37 |
|
38 |
CREATE VIEW count_c_type_by_date_created AS |
39 |
SELECT |
40 |
c_type_date_created, |
41 |
COUNT (c_type_id) AS count_c_type |
42 |
FROM c_type |
43 |
GROUP BY c_type_date_created; |
44 |
|
45 |
|
46 |
|
47 |
-- |
48 |
-- VIEW: count_c_news_by_date_created |
49 |
-- |
50 |
|
51 |
CREATE VIEW count_c_news_by_date_created AS |
52 |
SELECT |
53 |
c_news_date_created, |
54 |
COUNT (c_news_id) AS count_c_news |
55 |
FROM c_news |
56 |
GROUP BY c_news_date_created; |
57 |
|
58 |
|
59 |
-- |
60 |
-- VIEW: count_c_news_by_c_source |
61 |
-- |
62 |
|
63 |
CREATE VIEW count_c_news_by_c_source AS |
64 |
SELECT |
65 |
c_source_id, |
66 |
COUNT (c_news_id) AS count_c_news |
67 |
FROM |
68 |
c_news, |
69 |
c_source |
70 |
WHERE |
71 |
c_source_fk = c_source_id |
72 |
GROUP BY |
73 |
c_source_id; |
74 |
|
75 |
-- |
76 |
-- VIEW: view_count_c_news_by_c_source |
77 |
-- |
78 |
|
79 |
CREATE VIEW view_count_c_news_by_c_source AS |
80 |
SELECT |
81 |
c_source_description, |
82 |
count_c_news_by_c_source.c_source_id, |
83 |
count_c_news_by_c_source.count_c_news |
84 |
FROM |
85 |
count_c_news_by_c_source, |
86 |
c_source |
87 |
WHERE |
88 |
count_c_news_by_c_source.c_source_id = c_source.c_source_id |
89 |
ORDER BY |
90 |
c_source_description; |
91 |
|
92 |
|
93 |
-- |
94 |
-- VIEW: count_c_news_by_c_customer |
95 |
-- |
96 |
|
97 |
CREATE VIEW count_c_news_by_c_customer AS |
98 |
SELECT |
99 |
c_customer_id, |
100 |
COUNT (c_news_id) AS count_c_news |
101 |
FROM |
102 |
c_news, |
103 |
c_customer |
104 |
WHERE |
105 |
c_customer_fk = c_customer_id |
106 |
GROUP BY |
107 |
c_customer_id; |
108 |
|
109 |
-- |
110 |
-- VIEW: view_count_c_news_by_c_customer |
111 |
-- |
112 |
|
113 |
CREATE VIEW view_count_c_news_by_c_customer AS |
114 |
SELECT |
115 |
c_customer_name, |
116 |
count_c_news_by_c_customer.c_customer_id, |
117 |
count_c_news_by_c_customer.count_c_news |
118 |
FROM |
119 |
count_c_news_by_c_customer, |
120 |
c_customer |
121 |
WHERE |
122 |
count_c_news_by_c_customer.c_customer_id = c_customer.c_customer_id |
123 |
ORDER BY |
124 |
c_customer_name; |
125 |
|
126 |
|
127 |
-- |
128 |
-- VIEW: count_c_news_by_c_type |
129 |
-- |
130 |
|
131 |
CREATE VIEW count_c_news_by_c_type AS |
132 |
SELECT |
133 |
c_type_id, |
134 |
COUNT (c_news_id) AS count_c_news |
135 |
FROM |
136 |
c_news, |
137 |
c_type |
138 |
WHERE |
139 |
c_type_fk = c_type_id |
140 |
GROUP BY |
141 |
c_type_id; |
142 |
|
143 |
-- |
144 |
-- VIEW: view_count_c_news_by_c_type |
145 |
-- |
146 |
|
147 |
CREATE VIEW view_count_c_news_by_c_type AS |
148 |
SELECT |
149 |
c_type_description, |
150 |
count_c_news_by_c_type.c_type_id, |
151 |
count_c_news_by_c_type.count_c_news |
152 |
FROM |
153 |
count_c_news_by_c_type, |
154 |
c_type |
155 |
WHERE |
156 |
count_c_news_by_c_type.c_type_id = c_type.c_type_id |
157 |
ORDER BY |
158 |
c_type_description; |
159 |
|
160 |
|
161 |
|
162 |
-- END -- |
163 |
|
164 |
-- |
165 |
-- This program is free software; you can redistribute it and/or |
166 |
-- modify it under the terms of the GNU General Public License |
167 |
-- |