What is SQL Join? Write about its types. [5]

0
GK SIR
Mar 30, 2023 08:12 AM 0 Answers Database
Member Since Dec 2016
Subscribed Subscribe Not subscribe
Flag(0)

SQL join

  • A JOIN clause is a command to combine rows from two or more tables, based on a related column between them
  • Used to retrieve data from multiple tables

Types of SQL join

Inner join

  • Returns records that have matching values in both tables
  • Also known as Equi join.

Self Join

  • Sometime we need to join a table to itself. This type of join is called Self join. In this Join, we need to open two copies of a same table in the memory.

Left (Outer) Join:

  • Returns all records from the left table, and the matched records from the right table

Right (Outer) Join:

  • Returns all records from the right table, and the matched records from the lefttable

Full (Outer) Join:

  • Returns all records when there is a match in either left or right table

Cross Join

  • Combines all the rows from the left table with every row from the right table.
  • Returns Cartesian product of rows from tables in the join

SQL join

  • जोइन भनेको कमान्ड हो जसले सम्बन्ध स्थापित भएको कोलमका आधारमा दुई वा बढी टेबलकारेकर्डहरुलाई एकै ठाउँमा जम्मा गर्ने काम गर्छ ।
  • एक भन्दा बढी टेबलका डाटा देखाउन प्रयोग गरिन्छ ।

SQL join का प्रकार

Inner join

  • दुवै टेबलका मिल्दो रेकर्डलाई देखाउने काम गर्छ ।
  • Equi join पनि भनिन्छ ।

Self Join

  • एक टेबल यदि त्यही टेबलसँग join गरिन्छ भने त्यसलाई self joinभनिन्छ । यसका लागि एउटै टेबललाई दुई पटक ल्याउनुपर्ने हुन्छ ।

Left (Outer) Join:

  • बायाँ टेबलका सबै रेकर्ड तर दायाँ टबेलका मिल्दो रेकर्ड मात्र देखाउँछ ।

Right (Outer) Join:

  • दायाँ टेबलका सबै रेकर्ड तर बायाँ टेबलका मिल्दो रेकर्ड मात्र देखाउँछ ।

Full (Outer) Join:

  • दायाँ वा बायाँ मध्ये कुनै एउटामा मिलेका सबै रेकर्ड देखाउँछ ।

Cross Join

  • बायाँ टेबलका प्रत्येक रेकर्डको दायाँ टेबलका प्रत्येक रेकर्डसँगको जोडा देखाउँछ । यसलाइ कार्टिशियन प्रोडक्ट पनि भनिन्छ ।
0 Subscribers
Submit Answer
Please login to submit answer.
0 Answers
Sort By:

Leave a Reply

Your email address will not be published. Required fields are marked *

*