CREATE TABLE "deleteion" control

Andrew Sinning andrew at learningware.com
Tue Aug 19 14:24:40 CDT 2003


This next example is quite a bit more complex.  Each question can have
an 'Info,' an 'Intro', and a 'Hint', but as data is concerned, all three
of these things are of the type 'Info'.

In other words, in the table 'questions', the 3 fields 'infoId',
'introId' and 'hintId' all reference entries in the table 'info'.

//questions
CREATE TABLE questions
( qId UNIQUE NOT NULL,
  infoId REFERENCES infos.infoId ON DELETE SET_NULL,
  introId REFERENCES infos.infoId ON DELETE SET_NULL,
  hintId REFERENCES infos.infoId ON DELETE SET_NULL,
)


//infos
CREATE TABLE infos
( infoId UNIQUE NOT NULL,\
  stemText varchar(1024) NOT NULL,\
  graphicId REFERENCES graphics ON DELETE SET_NULL,\
  soundId REFERENCES sounds ON DELETE SET_NULL
)


I don't think this is going to work without explicitly referencing the
relationship, otherwise there will be ambiguity.

Furthermore, I'm not sure the syntax "introId REFERENCES infos.infoId"
is correct.

Any thoughts on what I'm getting at?  I hope I'm not turning this into a
free tutorial on relational dbs.  I've just never been exposed to this
concept.

Thanks.

-----Original Message-----
From: valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net]On Behalf Of Ruslan
Zasukhin
Sent: Tuesday, August 19, 2003 2:08 PM
To: valentina at lists.macserve.net
Subject: Re: CREATE TABLE "deleteion" control


on 8/19/03 21:55, Andrew Sinning at andrew at learningware.com wrote:

> What does using an ObjectPtr mean with regard to "NATURAL" joins?  In
> otherwords, do I still need to make the relationship between two
tables
> explicit with a WHERE t1.fieldName *= t2.fieldName, or is the
> relationship automatic?
>
> So, I have
>
> TABLE games
> gameId UNIQUE
> gameName
>
> TABLE questions
> questionId UNIQUE
> gameId REFERENCES games
>
>
> So, if I want to select questionId 275 along with it's parent game,
can
> I just use
>
> SELECT * FROM questions, games WHERE questionId = 275

YES!

> or do I need to specify: AND questions.gameId *= games.gameId

--
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------

_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina




More information about the Valentina mailing list