/[H6]/docs/pgsql.txt
ViewVC logotype

Annotation of /docs/pgsql.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 46 - (hide annotations) (download)
Wed Sep 6 19:16:26 2006 UTC (17 years, 8 months ago) by torben
File MIME type: text/plain
File size: 1638 byte(s)
Use timestamp instead of date
1 torben 44 -- Backup til genopbygning af databasen:
2     -- PostgreSQL
3    
4     -- Create the database and tables
5     create database h6projekt;
6     use h6projekt;
7    
8     create table Person (
9     PersonID serial primary key,
10     Initialer varchar(4) NOT NULL,
11     Navn varchar(50) NOT NULL,
12     Pass varchar(32),
13     Admin int
14     );
15    
16     create table Udstyr (
17     Stregkode bigint primary key NOT NULL,
18     Navn varchar(20) NOT NULL,
19     Beskrivelse varchar(200),
20     Placering varchar(20) NOT NULL,
21     Status int NOT NULL
22     );
23    
24     create table Udlån (
25     Udlånid serial primary key,
26     Personid int NOT NULL,
27     Stregkode bigint NOT NULL,
28 torben 46 Startdato timestamp NOT NULL,
29     Afleveringsdato timestamp,
30 torben 44 Antaldage int NOT NULL
31     );
32    
33     create table Resevation (
34     resevationid serial primary key,
35     Personid int NOT NULL,
36     Stregkode bigint NOT NULL,
37 torben 46 Startdato timestamp NOT NULL
38 torben 44 );
39    
40     create table Status (
41     Statusid int primary key,
42     Beskrivelse varchar(40) NOT NULL
43     );
44    
45     -- -----------------------------------------------
46     -- Basic data
47     INSERT INTO Person (Initialer,Navn,Pass,Admin)
48     VALUES ("ADM", 'Systems administrator', 'Admin', 1);
49    
50     INSERT INTO Status (Statusid, Beskrivelse)
51     VALUES (1,'Udlånt');
52    
53     INSERT INTO Status (Statusid, Beskrivelse)
54     VALUES (2,'Reserveret');
55    
56     INSERT INTO Status (Statusid, Beskrivelse)
57     VALUES (3,'Ledig');
58    
59     -- -----------------------------------------------
60     -- Testdata
61    
62     insert into Person (Initialer, Navn)
63     values ('JFRE', 'Jytte Fredriksen');
64    
65     insert into Udstyr (Stregkode, Navn, Beskrivelse, Placering)
66     values (5709068802148, 'Projektor', 'VGA Projektor', 'LM01');
67    

  ViewVC Help
Powered by ViewVC 1.1.20