File: gnade.postgres.sql

package info (click to toggle)
gnade 1.6.2-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 8,220 kB
  • ctags: 847
  • sloc: ada: 40,154; sh: 4,124; sql: 3,590; makefile: 1,372; xml: 120; awk: 29
file content (143 lines) | stat: -rw-r--r-- 6,799 bytes parent folder | download | duplicates (5)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
-- ----------------------------------------------------------------------------
--                                                                           --
--                      GNADE  : GNu Ada Database Environment                --
--                                                                           --
--  Filename        : $Source: /cvsroot/gnade/gnade/samples/sample_db/gnade.postgres.sql,v $
--  Description     : Makefile for the PostgreSQL sample database
--  Author          : Juergen Pfeifer <juergen.pfeifer@gmx.net> 
--  Created On      : 03-Jan-2001
--  Last Modified By: $Author: me $
--  Last Modified On: $Date: 2001/10/21 10:48:20 $
--  Status          : $State: Exp $
--
--  Copyright (C) 2000-2001
--
--  GNADE is copyrighted by the persons and institutions enumerated in the   --
--  AUTHORS file. This file is located in the root directory of the          --
--  GNADE distribution.                                                      --
--                                                                           --
--  GNADE is free software;  you can redistribute it  and/or modify it under --
--  terms of the  GNU General Public License as published  by the Free Soft- --
--  ware  Foundation;  either version 2,  or (at your option) any later ver- --
--  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--  for  more details.  You should have  received  a copy of the GNU General --
--  Public License  distributed with GNAT;  see file COPYING.  If not, write --
--  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--  MA 02111-1307, USA.                                                      --
--                                                                           --
--  As a special exception,  if other files  instantiate  generics from      --
--  GNADE Ada units, or you link GNADE Ada units or libraries with other     --
--  files  to produce an executable, these  units or libraries do not by     --
--  itself cause the resulting  executable  to  be covered  by the  GNU      --
--  General  Public  License.  This exception does not however invalidate    --
--  any other reasons why  the executable file  might be covered by the      --
--  GNU Public License.                                                      --
--                                                                           --
--  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
--                                                                           --
-- ----------------------------------------------------------------------------
--  Functional Description						     
--  ======================						     
--  This SQL Script generates the test data base as it is used by	     
--  the code in the ./samples directory. The demo user has username="gnade"  
--  and password="gnade".						     
--				                                              
--									     
--  Restrictions							     
--  ============							    
--  The script has been build and tested with postgres, but i believe	    
--  that the script is quite easy to adopt to others dbcs's.		    
--									    
--  References								    
--  ==========								    
--									    

CREATE TABLE "employees" (
        "empno"		 int4 NOT NULL,
        "name"		 character(20) NOT NULL,
        "firstname"	 character(20),
        "deptno"	 int4,
	"since"		 date,
        "manager"	 int4,
        "job"		 character(20),
        "promotion"	 bool,
        "salary"	 decimal(8,4)
);

CREATE TABLE "departments" (
        "deptno" int4 NOT NULL,
        "name" character(20) NOT NULL,
        "location" character(20)
);                                          


---  Testdata 
insert into "employees" values 
(  1, 'Erdmann',	'Michael',	1001,	'1999-12-31',	 2, 'Coding Monkey', 'T', 200.1234 );
insert into "employees" values 
(  2, 'Massalski',	'Marina',	1000,	'2000-01-09', null, 'Supervisor',    'F', 200.00 );
insert into "employees" values 
(  3, 'Tully',		'Noel',		1001,	'1959-01-23',	 2, 'Supervisor',    'T', 200.00 );
insert into "employees" values 
(  4, 'Pfeifer',	'Jrgen',	1001,	'2001-01-01',	 2, 'Designer',	     'T', 200.00 );
insert into "employees" values 
(  5, 'Smith',		'John',		1000,	'1980-06-11',	 3, 'Coding Monkey', 'T', 250.00 );
insert into "employees" values 
(  6, 'Smith',		'John',		1001,	'1972-06-11',	 3, 'Designer',	     'T', 820.00 );
insert into "employees" values 
( 50, 'Simpson',	'Bud',		1003,	'1980-06-11',	 3, 'Clerk',	     'F',  20.00 );
insert into "employees" values 
( 51, 'Bundy',		'Al',		1003,	'1980-06-11',	 3, 'Clerk',	     'F',  10.00 );
insert into "employees" values 
( 52, 'Bundy',		'Peggy',	1003,	'1988-06-15',	 3,  null,	     'F', -10.00 );
insert into "employees" values 
( 53, 'Simpson',	'Kelly',	1003,	'1995-09-11',	 3, 'Secretary',     'F',  20.00 );
insert into "employees" values 
(500, 'Rutherford',	'Ernest',	2000,	'1930-05-30',	 3, 'Genius',	     'T',1200.00 );
insert into "employees" values 
(501, 'Fermi',		null,		2000,	'1940-07-29',	 3, 'Genius',	     'T',1200.00 );
insert into "employees" values 
(502, 'Einstein',	'Albert',	2000,	'1941-04-30',	 2, 'Genius',	     'T',1200.00 );
insert into "employees" values 
(503, 'Fermi',		null,		2000,	'1020-08-15',	 2, 'Genius',	     'T',1200.00 );  

insert into "departments" 
   values( 1001, 'Sales',		'Berlin' );
insert into "departments" 
   values( 1000, 'Developement',	'Stuttgart' );
insert into "departments" 
   values( 1002, 'CM and Production',	'Bonn' );
insert into "departments" 
   values( 1003, 'Support',		'Chicago' );
insert into "departments" 
   values( 2000, 'Masterminds',		null );      


CREATE TABLE LOCATIONS (
        NAME     CHARACTER(20) NOT NULL PRIMARY KEY,
        CITY     VARCHAR(40),
        STREET   VARCHAR(80),
        NO       CHARACTER(5),
        ZIPCODE  INT
) ;


insert into locations
   values( 'Berlin', 'Berlin','Siemensdamm', '50a', 10243 );                  
insert into locations
   values( 'Bonn', 'Bonn','Oberkasselerstrasse', '8', 47112 );          
insert into locations
   values( 'Stuttgart', 'Stuttgart','Lorenzweg', '1', 60001 );          
insert into locations
   values( 'Chicage', 'Chicago','Bundy Stree', '9996', 70001 );          

-- ACL Information. This may have to be changed if a different DBCS is used
REVOKE ALL on "employees" from PUBLIC;
REVOKE ALL on "departments" from PUBLIC;
REVOKE ALL on "locations" from PUBLIC;
GRANT ALL on "employees" to PUBLIC;
GRANT ALL on "departments" to PUBLIC;
GRANT ALL on "locations" to PUBLIC;