MySQL + SQL · Lesson 66

MySQL में SQL Join Examples

Practical Join Queries

School database पर हल किए JOIN queries — exams और projects में common।

Students को Class Names के साथ List करें

SELECT s.name, c.class_name
FROM students s
JOIN classes c ON s.class_id = c.class_id;

हर Student की Fees

SELECT s.name, SUM(f.amount) AS total_paid
FROM students s
JOIN fees f ON s.roll_no = f.roll_no
GROUP BY s.name;

तीन-Table Join

SELECT s.name, c.class_name, f.amount
FROM students s
JOIN classes c ON s.class_id = c.class_id
JOIN fees f ON s.roll_no = f.roll_no;
तीन या ज़्यादा tables जोड़ने के लिए JOINs chain कर सकते हैं।

सारांश

  • JOIN + GROUP BY related data summarise करता है (जैसे हर student की कुल fees)।
  • तीन या ज़्यादा tables के लिए कई JOINs chain करें।
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 लाइव कोड एडिटर

इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.