← All references

JOIN

INNER JOIN / LEFT JOIN / RIGHT JOIN

दो तालिकाओं से पंक्तियाँ मिलाएं।

JOIN

संबंधित कॉलम के आधार पर दो तालिकाओं से पंक्तियाँ मिलाता है।

प्रकार

  • INNER JOIN — दोनों से केवल मेल खाती पंक्तियाँ।
  • LEFT JOIN — सभी बाएँ + मेल खाते दाएँ।
  • RIGHT JOIN — सभी दाएँ + मेल खाते बाएँ।
  • FULL OUTER JOIN — दोनों से सभी।

``sql\nSELECT u.name, o.total\nFROM users u\nINNER JOIN orders o ON u.id = o.user_id;\n``

Example

SELECT u.name, o.total, o.status\nFROM users u\nINNER JOIN orders o ON u.id = o.user_id\nWHERE o.status = 'delivered'\nORDER BY o.total DESC;