Wednesday, March 28, 2012

Is it possible to make use of database relationships in a join?

When you make a join, it may look something like this:

SELECT Products.ProductName from Products, Categories
WHERE Categories.CategoryName = 'Seafood' AND
Products.CategoryID = Categories.CategoryID

In this query you use 'Products.CategoryID = Categories.CategoryID' to give the relation between the two tables. But if you already added the relationships to your database, this should be known.

My question is, why is it necessary to add the relation in the query when the relationships are already in the database? Is it somehow possible to ommit the relation in the query and make use of the relationships in the database.

Kind regards,
Iwan RotteveelRelationships (also known as Declarative Referential Integrity constraints) are not for DML operations, but rather for enforcement of data integrity that can be affected by DML should there be no DRI on related tables.|||thats a good note...

Just so im clear, DDL as in INSERT, UPDATE, etc

DML as in JOIN etc?|||No,

DDL = Data Definition Language (CREATE, ALTER)

DML = Data Manipulation Language (INSERT, UPDATE, SELECT, DELETE)

Regards,

hmscott

thats a good note...

Just so im clear, DDL as in INSERT, UPDATE, etc

DML as in JOIN etc?|||And lest we forget...

DCL

EDIT: Damn...some lexicon...|||Did you mean "at least" or "...and lest" ?

-PatP

No comments:

Post a Comment