pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gemeinschaft Studienarbeit Datenbanken <oodbms@floppy.org>
To: PostgreSQL SQL Mailing List <pgsql-sql@hub.org>
Cc: Datenbanksysteme Studienarbeit <oodbms@floppy.org>
Subject: select-querries out of an array?
Date: Tue, 06 Oct 1998 16:03:30 +0100
Message-ID: <199810061603.3142469.6@onyx.floppy.org> (raw)

Hiho,

I have a question which neither the samples (as far as I was able to
figure out) or the documentation were able to clear up.

I have a table definition like

(btw. why isn't the primary key of the Spiel-class inherited by the
 children classes???)

create table Spiel (
 Name				text not null,
 Bestellnummer  		text not null primary key,
 HerstellerID			int4 not null,
 Erscheinungsdatum		datetime,
 Preisempfehlung 		money not null,
 Beschreibung			text[],
 Computertyp			text[] not null,
 Datentraegertyp		text[] not null,
 ClueBook			text[] );

create table rollenspiel (
 Bestellnummer  		text not null primary key,
 System				text not null,
 AnzahlCharaktere		int2 not null,
 Typ				text not null,
 SpielstandEditor		text[] ) inherits ( spiel );

create table adventure (
 Bestellnummer  		text not null primary key,
 Schwierigkeitsgrad		int2 not null ) inherits ( spiel );

create table simulation (
 Bestellnummer  		text not null primary key,
 Typ				text[] not null,
 AnzahlChars			int2 not null ) inherits ( spiel );

create table action (
 Bestellnummer  		text not null primary key,
 Eingabegeraet			text[] not null,
 AnzahlSpieler			int2 not null ) inherits ( spiel );

with several subclasses which inherit attributes from the parent class.

When I now would like to have all games (Spiel*) selected, which come
on CD as media (Datentraegertyp is array which contains CD, Disks, misc,
etc.), I would type the sql request like this:

select name from Spiel* where Datentraegertyp = '{"CD"}';

which only lists all games which *ONLY* come on CD (pretty clear as the
match is '=' on the single array entry. How do I formulate the request when
I would like to have those which have Datentraegertyp like '{"CD", "Diskette"}'
or '{"Tape", "Diskette", "CD"}' ?

I hope you get what I am up to ;-)

Thanks once again for hints.







view thread (2+ messages)  latest in thread

Message-ID: <199810061603.3142469.6@onyx.floppy.org>
Permalink:  ../199810061603.3142469.6@onyx.floppy.org/
Also on:    postgresql.org/message-id/199810061603.3142469.6@onyx.floppy.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: oodbms@floppy.org, pgsql-sql@hub.org
  Subject: Re: select-querries out of an array?
  In-Reply-To: <199810061603.3142469.6@onyx.floppy.org>
  References: <199810061603.3142469.6@onyx.floppy.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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