This question specifically deals with PostrgreSQL and other
SQL-compliant databases. I say this, because the question deals with
foreign keys and constraints, which I'm pretty sure MySQL doesn't deal
with properly, if at all.
I have the following table, which most other tables reference:
However, I want to restrict the member column by restricting the data
in it to also exist *either* in machines.id *OR* in classes.id. The
reason for this is that a class member can either be a machine or
another class (think netgroups here). Does anyone know how to do
this, or if it's even
Dan Coutu [EMAIL PROTECTED] writes:
hosts=# \d classes
Table public.classes
Column | Type | Modifiers
--++-
id| integer| not null
Ray Cote [EMAIL PROTECTED] writes:
However, I want to restrict the member column by restricting the data
in it to also exist *either* in machines.id *OR* in classes.id. The
reason for this is that a class member can either be a machine or
another class (think netgroups here). Does anyone know
Dan,
Is this what you meant:
class_types:
id | integer | nextval
name | text| not null
primary key: id
classes:
id | integer | nextval
name | text| not null
type | integer | not null
primary key: id
foreign key: type references
Paul Lussier wrote:
Dan,
Is this what you meant:
class_types:
id | integer | nextval
name | text| not null
primary key: id
classes:
id | integer | nextval
name | text| not null
type | integer | not null
primary key: id
foreign key: type
Dan Coutu [EMAIL PROTECTED] writes:
Yes, this would work. Because the members table is provided a many
(members) to one (class) relationship you can build data structures of
arbitrary depth. Further, by using the class type indicator you can
later expand the logic to include things that you
Hi All,
I'd like to preface this question by saying I don't
know much about databases. But I am trying to work
with a customer who is trying to do the following...
I am supplying them with scanning equipment that can
produce a pdf file with meta data in the file name.
It will look something
Do you mean something like:
#!/bin/sh
FILENAME=`basename $1 .pdf`
set -- `echo $FILENAME | sed -e 's/_/ /g'`
p1=$1
p2=$2
p3=$3
p4=$4
p5=$5
# Following assumes the testtable table has already be created in #
mysql's test database.
echo insert into