Subqueries
-
Hi, I want to know that while creating suqueries in SQL Server,it is mandatory to have Primary key and Foreign key relationships between the tables??? In short:-I want to know if we create subqueries without p.k and F.k realtionships,then it will work??? What is the main purpose of Subqueries??? Thanks...
-
Hi, I want to know that while creating suqueries in SQL Server,it is mandatory to have Primary key and Foreign key relationships between the tables??? In short:-I want to know if we create subqueries without p.k and F.k realtionships,then it will work??? What is the main purpose of Subqueries??? Thanks...
In Short: Yes The relationship structure is an integral part of the data structure but is not required for sub queries. Sub queries are just another tool for getting your data from the database the way you want it. Like CTEs and the various joins they are all aspects of TSQL.
Never underestimate the power of human stupidity RAH
-
In Short: Yes The relationship structure is an integral part of the data structure but is not required for sub queries. Sub queries are just another tool for getting your data from the database the way you want it. Like CTEs and the various joins they are all aspects of TSQL.
Never underestimate the power of human stupidity RAH
I have often wondered this myself. Since I can perform a join simply by saying "WHERE a.field = b.field", what is the ultimate purpose of setting up a relationship?
The difficult we do right away... ...the impossible takes slightly longer.
-
I have often wondered this myself. Since I can perform a join simply by saying "WHERE a.field = b.field", what is the ultimate purpose of setting up a relationship?
The difficult we do right away... ...the impossible takes slightly longer.
Richard Andrew x64
what is the ultimate purpose of setting up a relationship?
Wonde Tadesse
-
I have often wondered this myself. Since I can perform a join simply by saying "WHERE a.field = b.field", what is the ultimate purpose of setting up a relationship?
The difficult we do right away... ...the impossible takes slightly longer.
Wonde nailed it, IMHO referential integrity and constraints are the last line of defense to keep the garbage in. They also help with optimisation of course.
Never underestimate the power of human stupidity RAH