pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCreating schema in postgres
3+ messages / 3 participants
[nested] [flat]
* Creating schema in postgres
@ 2001-11-28 10:35 Jyoti Patil <Jyoti@ionit.co.uk>
2001-11-28 16:36 ` Re: Creating schema in postgres Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-11-28 16:39 ` Re: Creating schema in postgres Andrew G. Hammond <drew@xyzzy.dhs.org>
0 siblings, 2 replies; 3+ messages in thread
From: Jyoti Patil @ 2001-11-28 10:35 UTC (permalink / raw)
To: pgsql-admin
Hi,
I would like to know how can we create a schema in postgres.
Many thanks
Jyoti.
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Creating schema in postgres
2001-11-28 10:35 Creating schema in postgres Jyoti Patil <Jyoti@ionit.co.uk>
@ 2001-11-28 16:36 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
1 sibling, 0 replies; 3+ messages in thread
From: Stephan Szabo @ 2001-11-28 16:36 UTC (permalink / raw)
To: Jyoti Patil <Jyoti@ionit.co.uk>; +Cc: pgsql-admin
On Wed, 28 Nov 2001, Jyoti Patil wrote:
> Hi,
>
> I would like to know how can we create a schema in postgres.
You can't yet. Hopefully it'll be in 7.3.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Creating schema in postgres
2001-11-28 10:35 Creating schema in postgres Jyoti Patil <Jyoti@ionit.co.uk>
@ 2001-11-28 16:39 ` Andrew G. Hammond <drew@xyzzy.dhs.org>
1 sibling, 0 replies; 3+ messages in thread
From: Andrew G. Hammond @ 2001-11-28 16:39 UTC (permalink / raw)
To: Jyoti Patil <Jyoti@ionit.co.uk>; pgsql-admin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2001 November 28 05:35 am, Jyoti Patil wrote:
> I would like to know how can we create a schema in postgres.
There are graphical front end tools available that will do this for you, but
it all comes down to CREATE statements in SQL. You can communicate dirrectly
with the database (in SQL) using the psql command line utility that comes
with the database. To create a schema (in psql), you might do something like
the following:
- -- table to list people
CREATE TABLE person (id SERIAL PRIMARY KEY,
given_name TEXT NOT NULL,
surname TEXT NOT NULL,
birth_date DATE CHECK (birth_date > 1960-01-01), -- no old people allowed
eye_colour TEXT );
- -- table to list friendships ( n to m relationship of person to person)
CREATE TABLE friend (id SERIAL PRIMARY KEY,
person_a INTEGER REFERENCES person(id),
person_b INTEGER REFERENCES person(id) );
- -- pets ( 1 to n relationship of people to pets)
CREATE TABLE pet (id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
type TEXT NOT NULL CHECK (type IN ('cat', 'dog', 'bird', 'llama')),
owner INTEGER REFERENCES person(id) );
And, to increase the performance of sorts and selects, create some indices on
the above tables:
CREATE INDEX p_a_idx ON person (given_name, surname);
CREATE INDEX p_b_idx ON person (surname, given_name);
CREATE INDEX f_a_idx ON friend (person_a);
CREATE INDEX f_b_idx ON friend (person_b);
CREATE INDEX pet_owner_idx ON pet(owner);
Anyway, I hope this is enough to get you pointed in the right dirrection.
Feel free to ask me for more details.
- --
Andrew G. Hammond mailto:drew@xyzzy.dhs.org http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481
5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjwFE1AACgkQCT73CrRXhLGQhACfZPFhzCDoODJh/fdL7e36uozP
iL4An1WmIo6bm1Bysu7WHbpQQUZ1gM0w
=vFbY
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-11-28 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-28 10:35 Creating schema in postgres Jyoti Patil <Jyoti@ionit.co.uk>
2001-11-28 16:36 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-11-28 16:39 ` Andrew G. Hammond <drew@xyzzy.dhs.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox