Combine two tables based on the first table records

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago


I have two tables like this,

  Class  |  Name     | Unit  | Year
 --------+-----------+-------+--------
  10th   |  Language |  2    | 2014
  10th   |  Maths    |  3    | 2014

Second table,

      Name  | Title | Period | Syllabus
  ----------+-------+--------+-----------------------------
   Language |Unit1  | 8      | Subject1, Subject2, Subject3
   Language |Unit2  | 9      | Subject4, Subject5, Subject6
    Maths   |Unit1  | 7      | Subject1, Subject2, Subject3
    Maths   |Unit2  | 8      | Subject4, Subject5, Subject6
    Maths   |Unit3  | 9      | Subject5, Subject6, Subject7

And the result Should be,

      Language

      Title | Period | Syllabus
    ----------------------------------
     Unit1  | 8      | Subject1, Subject2, Subject3
     Unit2  | 9      | Subject4, Subject5, Subject6

      Maths

      Title | Period | Syllabus
    ----------------------------------
     Unit1  | 7      | Subject1, Subject2, Subject3
     Unit2  | 8      | Subject4, Subject5, Subject6
     Unit3  | 9      | Subject5, Subject6, Subject7

Second table result is base on the first table name..

Can anyone help me in python with mysql? i'm very to python..

profilepic.png
manpreet 2 years ago
--To get language details:
SELECT title, period, syllabus
FROM Second
WHERE Name = 'Language' --replace language with Maths here to get maths subject details

--To get details from table1 and table2
SELECT s.title, s.period, s.syllabus, r.year
FROM Second s INNER JOIN First f
ON f.Name = s.Name
WHERE Name = 'Language' --replace language with Maths here to get maths subject details
 

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.