"content":"<p>Table: <code>Students</code></p>\n\n<pre>\n+---------------+---------+\n| Column Name | Type |\n+---------------+---------+\n| student_id | int |\n| student_name | varchar |\n+---------------+---------+\nstudent_id is the primary key (column with unique values) for this table.\nEach row of this table contains the ID and the name of one student in the school.\n</pre>\n\n<p> </p>\n\n<p>Table: <code>Subjects</code></p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| subject_name | varchar |\n+--------------+---------+\nsubject_name is the primary key (column with unique values) for this table.\nEach row of this table contains the name of one subject in the school.\n</pre>\n\n<p> </p>\n\n<p>Table: <code>Examinations</code></p>\n\n<pre>\n+--------------+---------+\n| Column Name | Type |\n+--------------+---------+\n| student_id | int |\n| subject_name | varchar |\n+--------------+---------+\nThere is no primary key (column with unique values) for this table. It may contain duplicates.\nEach student from the Students table takes every course from the Subjects table.\nEach row of this table indicates that a student with ID student_id attended the exam of subject_name.\n</pre>\n\n<p> </p>\n\n<p>Write a solution to find the number of times each student attended each exam.</p>\n\n<p>Return the result table ordered by <code>student_id</code> and <code>subject_name</code>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nStudents table:\n+------------+--------------+\n| student_id | student_name |\n+------------+--------------+\n| 1 | Alice |\n| 2 | Bob |\n| 13 | John |\n| 6 | Alex |\n+------------+--------------+\nSubjects table:\n+--------------+\n| subject_name |\n+--------------+\n| Math |\n| Physics |\n| Programming |\n+--------------+\nExaminations table:\n+------------+--------------+\n| student_id | subject_name |\n+------------+--------------+\n| 1 | Math |\n| 1 | Physics |\n| 1 | Programming |\n| 2 | Programming |\n| 1 | Physics |\n| 1 | Math |\n| 13 | Math |\n| 13 | Programming |\n| 13 | Physics |\n| 2 | Math |\n| 1 | Math |\n+------------+--------------+\n<strong>Output:</strong> \n+------------+--------------+--------------+----------------+\n| student_id | student_name | subject_name | attended_exams |\n+------------+--------------+--------------+----------------+\n| 1 | Alice | Math | 3 |\n| 1 | Alice | Physics | 2 |\n| 1 | Alice | Programming | 1 |\n| 2 | Bob | Math | 1 |\n| 2 | Bob | Physics | 0 |\n| 2 | Bob | Programming | 1 |\n| 6 | Alex | Math | 0 |\n| 6 | Alex | Physics | 0 |\n| 6 | Alex | Programming | 0 |\n| 13 | John | Math | 1 |\n| 13 | John | Physics | 1 |\n| 13 | John | Programming | 1 |\n+------------+--------------+--------------+----------------+\n<strong>Explanation:</strong> \nThe result table should contain all students and all subjects.\nAlice attended the Math exam 3 times, the Physics exam 2 times, and the Programming exam 1 time.\nBob attended the Math exam 1 time, the Programming exam 1 time, and did not attend the Physics exam.\nAlex did not attend any exams.\nJohn attended the Math exam 1 time, the Physics exam 1 time, and the Programming exam 1 time.\n</pre>\n",