Click here to Skip to main content
15,033,917 members
Home / Discussions / Database
   

Database

 
GeneralRe: DTS Package Pin
S Douglas19-Aug-11 12:51
professionalS Douglas19-Aug-11 12:51 
Questionjoint Pin
vinodh.K19-Aug-11 0:39
Membervinodh.K19-Aug-11 0:39 
AnswerRe: joint Pin
Blue_Boy19-Aug-11 0:40
MemberBlue_Boy19-Aug-11 0:40 
AnswerRe: joint Pin
Richard MacCutchan19-Aug-11 0:46
mveRichard MacCutchan19-Aug-11 0:46 
AnswerRe: joint Pin
Pete O'Hanlon19-Aug-11 1:14
mvePete O'Hanlon19-Aug-11 1:14 
GeneralRe: joint Pin
Tim Carmichael19-Aug-11 4:00
MemberTim Carmichael19-Aug-11 4:00 
AnswerRe: joint Pin
Mycroft Holmes19-Aug-11 3:10
professionalMycroft Holmes19-Aug-11 3:10 
AnswerRe: joint Pin
S Douglas19-Aug-11 12:58
professionalS Douglas19-Aug-11 12:58 
vinodh.K wrote:
anybody can tell me about joints

Assuming you really meant SQL Joins

There are six, types of joins.

1: Left join
Return all records from the left most table on the join.

SELECT
    e.*
    , a.*
FROM employee AS e (Notice the AS, that creates an alias to that table)
    LEFT OUTER JOIN Address a (e.EmployeeKey = a.EmployeeKey)

Returns all of the records in the employees table, and only those from the address table that actualy match

2: Right join
Return all records from the right most table on the join.
SELECT
    e.*
    , a.*
FROM employee AS e (Notice the AS, that creates an alias to that table)
    RIGHT OUTER JOIN Address a (e.EmployeeKey = a.EmployeeKey)
Returns all of the records in the Adreess table, and only those from the employees table that actualy match

3: Full Join
Returns all rows from both Tables
SELECT
    e.*
    , a.*
FROM employee AS e (Notice the AS, that creates an alias to that table)
    FULL JOIN Address a (e.EmployeeKey = a.EmployeeKey)

4: Inner join

Return only records where both keys match exactly.
SELECT
    e.*
    , a.*
FROM employee AS e (Notice the AS, that creates an alias to that table)
    INNER OUTER JOIN Address a (e.EmployeeKey = a.EmployeeKey)

Returns all of the Employes and Adresses where both keys match exactly

5: Cross Join
Use this with caution, all records on all sides are paired and returned

SELECT
    e.*
    , a.*
FROM employee AS e (Notice the AS, that creates an alias to that table)
    CROSS JOIN Address a (e.EmployeeKey = a.EmployeeKey)

This is the most expensive join posible, as for every record on both sides are returned, so if you had two tables that had ten rows in each, 100 rows would be returned.

6 Self Join
SELECT
    e1.*
    , e2.*
FROM employee AS e1 (Notice the AS, that creates an alias to that table)
    JOIN employee e2 (e1.EmployeeKey = e2.EmployeeKey)


Common sense is admitting there is cause and effect and that you can exert some control over what you understand.


AnswerRe: joint Pin
Ganu Sharma15-Sep-11 21:20
MemberGanu Sharma15-Sep-11 21:20 
QuestionCreate a trigger Pin
lionelcyril18-Aug-11 18:29
Memberlionelcyril18-Aug-11 18:29 
AnswerRe: Create a trigger Pin
Wendelius18-Aug-11 19:07
mveWendelius18-Aug-11 19:07 
GeneralRe: Create a trigger Pin
lionelcyril18-Aug-11 19:12
Memberlionelcyril18-Aug-11 19:12 
GeneralRe: Create a trigger Pin
Wendelius18-Aug-11 19:18
mveWendelius18-Aug-11 19:18 
AnswerRe: Create a trigger [modified] Pin
Shameel18-Aug-11 23:03
professionalShameel18-Aug-11 23:03 
QuestionSQL Query From Query Results Pin
Kyudos18-Aug-11 14:36
MemberKyudos18-Aug-11 14:36 
AnswerRe: SQL Query From Query Results Pin
Mycroft Holmes18-Aug-11 15:04
professionalMycroft Holmes18-Aug-11 15:04 
GeneralRe: SQL Query From Query Results Pin
Kyudos18-Aug-11 15:22
MemberKyudos18-Aug-11 15:22 
GeneralRe: SQL Query From Query Results Pin
Kyudos18-Aug-11 18:34
MemberKyudos18-Aug-11 18:34 
GeneralRe: SQL Query From Query Results Pin
Mycroft Holmes18-Aug-11 20:38
professionalMycroft Holmes18-Aug-11 20:38 
GeneralRe: SQL Query From Query Results Pin
Kyudos18-Aug-11 22:07
MemberKyudos18-Aug-11 22:07 
GeneralRe: SQL Query From Query Results Pin
Mycroft Holmes18-Aug-11 22:19
professionalMycroft Holmes18-Aug-11 22:19 
Questionplz brack my licence Pin
saqibali211918-Aug-11 8:08
Membersaqibali211918-Aug-11 8:08 
AnswerRe: plz brack my licence Pin
Mycroft Holmes18-Aug-11 20:41
professionalMycroft Holmes18-Aug-11 20:41 
QuestionCannot start MSSQLSERVER Pin
Blikkies17-Aug-11 22:02
professionalBlikkies17-Aug-11 22:02 
AnswerRe: Cannot start MSSQLSERVER Pin
Mycroft Holmes17-Aug-11 23:02
professionalMycroft Holmes17-Aug-11 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.