Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: SELECT and RESTRICT statements

Re: SELECT and RESTRICT statements

From: Troels Arvin <troels_at_arvin.dk>
Date: Sat, 08 Oct 2005 22:05:20 +0200
Message-ID: <pan.2005.10.08.20.05.20.175232@arvin.dk>


On Sat, 08 Oct 2005 04:49:03 -0700, Jenski wrote:

> Was just wondereding if anybody could clarify for me what the difference
> is between SELECT and RESTRICT is, in SQL ?

The two keywords are not really comparable.

As long as you stay in the SQL World, things are somewhat simple:

SELECT is part of SQL's data retrieval language subset; it determines which of the columns from the result you want in your result set.

RESTRICT is part of SQL's data definition language subset. It is used in some contexts (like when defining a foreign key) to state that an action may not propagate. E.g. you could add a foreign key constraint like this:

ALTER TABLE foo ADD CONSTRAINT foo_bar_fk FOREIGN KEY (bar_id) REFERENCES bar(bar_id) ON DELETE RESTRICT

RESTRICT can also be part of a command, like: DROP TABLE bar RESTRICT;

In both the above examples, RESTRICT is actually superfluous, as it's the default in all databases, as far as I know.

Now, if we expand our perspective beyond an SQL only World: To really complicate matters, "restrict" and "select" are synonyms in relational algebra. Things get really tricky when you consider that SQL's SELECT keyword is analogous to relational algebra's "project" operation. So we have the following table of operator names:

Relational algebra term   Relational algebra symbol      SQL keyword
=======================   =========================      ===========
restrict                  small sigma                    WHERE
select                    small sigma                    WHERE
project                   small pi                       SELECT

-- 
Greetings from Troels Arvin
Received on Sat Oct 08 2005 - 15:05:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US