I have two tables "Student_Info Table" and "Training_Status Table"
Student_Info contains information about name , groupId of student , group roll number of student , age etc. Training_Status Table contains entries of status of training of different students
Structure of tables is as follow:
Student_Info Table
groupId GroupRollNo Name Age Level
- - - - - - - - - - - - - - - - - - - - - - - -
G1 1 Sam 24 4
G1 2 David 25 2
G1 3 Robin 26 3
G1 4 John 28 4
G2 1 Harry 26 3
G2 2 Jerry 28 4
G3 1 Michel 28 3
G3 2 Jerry 28 4
G4 1 Michel 28 3
Students are divided into different groups G1 , G2 , G3 Students in the same group can not have same GroupRollNo. but students from different groups can have same GroupRollNo.
Training_Status Table
groupId GroupRollNo TrainingStatus
- - - - - - - - - - - - - - - - - - - - -
G1 2 InProgress
G1 3 OnHold
G3 1 InProgress
G3 2 Completed
As the training of a student starts Entry is made into "Training_Status Table" with groupId and GroupRollNo and Training Status. and the table is updated with the status of training (OnHold , completed)
Considering the Scenario
There are 100 students in the Student_Info Table divided into different groups. (say G1 , G2 , G3 ). Training_Status Table has only 10 entries (only of those students whose training has started ) from different groups with current status.
I need to fetch the Training Status of all students from a particular group with full details of student from two tables.
Like I need to fetch the Training status of all students of G1 (Group 1) with full details of students from a Sqlite DB query.
Expected desired result of query
groupId GroupRollNo Name Age Level TrainingStatus
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
G1 1 Sam 24 4 NULL(means training not started)
G1 2 David 25 2 InProgress
G1 3 Robin 26 3 OnHold
G1 4 John 28 4 NULL(means training not started)
What sqlite Query should I write So that I get the result in the desired format from Two Tables.