Non-registered mode. Register to save your course progress.
By exploring the course, you are agreeing to our Terms of Service and Privacy Policy. Please read them carefully.
<div class="xblock xblock-student_view xblock-student_view-vertical" data-runtime-class="LmsRuntime" data-init="VerticalStudentView" data-course-id="DB/SQL/SelfPaced" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_vertical;_vert-exercise-sql_social_query_extra" data-block-type="vertical">
<h2 class="hd hd-2 unit-title">SQL Social-Network Query Exercises Extras</h2>
<div class="bookmark-button-wrapper">
<button class="btn btn-link bookmark-button "
aria-pressed="false"
data-bookmark-id="anon__2fMr3Nf4WnVUilCdSua3uhGY,i4x://DB/SQL/vertical/vert-exercise-sql_social_query_extra"
data-bookmarks-api-url="/api/bookmarks/v1/bookmarks/">
<span class="bookmark-text">Bookmark this page</span>
</button>
</div>
<div class="vert-mod">
<div class="vert vert-0" data-id="i4x://DB/SQL/html/preamble-exercise-sql_social_query_extra">
<div class="xblock xblock-student_view xblock-student_view-html xmodule_display xmodule_HtmlModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="html" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_html;_preamble-exercise-sql_social_query_extra" data-type="HTMLModule" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p>Students at your hometown high school have decided to organize their social network using databases. So far, they have collected information about sixteen students in four grades, 9-12. Here's the schema: <br /> <br /> Highschooler ( ID, name, grade ) <br /> English: There is a high school student with unique <span style="font-style: italic;">ID</span> and a given <span style="font-style: italic;">first name</span> in a certain <span style="font-style: italic;">grade</span>. <br /> <br /> Friend ( ID1, ID2 ) <br /> English: The student with <span style="font-style: italic;">ID1</span> is friends with the student with <span style="font-style: italic;">ID2</span>. Friendship is mutual, so if (123, 456) is in the Friend table, so is (456, 123). <br /> <br /> Likes ( ID1, ID2 ) <br /> English: The student with <span style="font-style: italic;">ID1</span> likes the student with <span style="font-style: italic;">ID2</span>. Liking someone is not necessarily mutual, so if (123, 456) is in the Likes table, there is no guarantee that (456, 123) is also present. <br /> <br /> Your queries will run over a small data set conforming to the schema. <a href="/c4x/DB/SQL/asset/socialdata.html" target="_blank">View the database</a>. (You can also <a target="[object Object]" href="https://s3-us-west-2.amazonaws.com/prod-c2g/db/Winter2013/files/social.sql">download the schema and data</a>.) <br /> <br /> For your convenience, here is a graph showing the various connections between the students in our database. 9th graders are blue, 10th graders are green, 11th graders are yellow, and 12th graders are purple. Undirected black edges indicate friendships, and directed red edges indicate that one student likes another student. </p>
<div style="text-align: center;"><img style="width: 494px; height: 352px;" alt="Social graph" title="Social graph" src="/assets/courseware/v1/db2bd56806a9ee925f626a01600a97f9/c4x/DB/SQL/asset/social.png" /></div>
<p><br /> <br /> <b>Instructions:</b> Each problem asks you to write a query in SQL. When you click "Check Answer" our back-end runs your query against the sample database using SQLite. It displays the result and compares your answer against the correct one. When you're satisfied with your solution for a given problem, click the "Save Answers" button to save your progress. Click "Submit Answers" to submit the entire exercise set. <br /> <br /> <b>Important Notes:</b></p>
<ul>
<li style="margin-top: 1em;">Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.</li>
<li style="margin-top: 1em;">Unless a specific result ordering is asked for, you can return the result rows in any order.</li>
<li style="margin-top: 1em;"><i>You are to translate the English into a SQL query that computes the desired result over all possible databases.</i> All we actually check is that your query gets the right answer on the small sample database. Thus, even if your solution is marked as correct, it is possible that your query does not correctly reflect the problem at hand. (For example, if we ask for a complex condition that requires accessing all of the tables, but over our small data set in the end the condition is satisfied only by Star Wars, then the query "select title from Movie where title = 'Star Wars'" will be marked correct even though it doesn't reflect the actual question.) Circumventing the system in this fashion will get you a high score on the exercises, but it won't help you learn SQL. On the other hand, an incorrect attempt at a general solution is unlikely to produce the right answer, so you shouldn't be led astray by our checking system.</li>
</ul>
<p><br /> You may perform these exercises as many times as you like, so we strongly encourage you to keep working with them until you complete the exercises with full credit.</p>
</div>
</div>
<div class="vert vert-1" data-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra1">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra1" data-type="Problem" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-SQL-problem-exercise-sql_social_query_extra1" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-SQL-problem-exercise-sql_social_query_extra1-problem-title"
data-problem-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra1" data-url="/courses/DB/SQL/SelfPaced/xblock/i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra1/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="i4x-DB-SQL-problem-exercise-sql_social_query_extra1-problem-title" aria-describedby="i4x://DB/SQL/problem/exercise-sql_social_query_extra1-problem-progress" tabindex="-1">
Q1
</h3>
<div class="problem-progress" id="i4x://DB/SQL/problem/exercise-sql_social_query_extra1-problem-progress"></div>
<div class="problem">
<div>
<span>
For every situation where student A likes student B, but student B likes a different student C, return the names and grades of A, B, and C.
<br/>
<br/>
<b>Note:</b> Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1" id="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your SQL query here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra1_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q1" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra1" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra1">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra1-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra1-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra1-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="False">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra2">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra2" data-type="Problem" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-SQL-problem-exercise-sql_social_query_extra2" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-SQL-problem-exercise-sql_social_query_extra2-problem-title"
data-problem-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra2" data-url="/courses/DB/SQL/SelfPaced/xblock/i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="i4x-DB-SQL-problem-exercise-sql_social_query_extra2-problem-title" aria-describedby="i4x://DB/SQL/problem/exercise-sql_social_query_extra2-problem-progress" tabindex="-1">
Q2
</h3>
<div class="problem-progress" id="i4x://DB/SQL/problem/exercise-sql_social_query_extra2-problem-progress"></div>
<div class="problem">
<div>
<span>
Find those students for whom all of their friends are in different grades from themselves. Return the students' names and grades.
<br/>
<br/>
<b>Note:</b> Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1" id="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your SQL query here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra2_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q2" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra2" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra2">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra2-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="False">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra3">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra3" data-type="Problem" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-SQL-problem-exercise-sql_social_query_extra3" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-SQL-problem-exercise-sql_social_query_extra3-problem-title"
data-problem-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra3" data-url="/courses/DB/SQL/SelfPaced/xblock/i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra3/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="i4x-DB-SQL-problem-exercise-sql_social_query_extra3-problem-title" aria-describedby="i4x://DB/SQL/problem/exercise-sql_social_query_extra3-problem-progress" tabindex="-1">
Q3
</h3>
<div class="problem-progress" id="i4x://DB/SQL/problem/exercise-sql_social_query_extra3-problem-progress"></div>
<div class="problem">
<div>
<span>
What is the average number of friends per student? (Your result should be just one number.)
<br/>
<br/>
<b>Note:</b> Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1" id="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your SQL query here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra3_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q3" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra3" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra3">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra3-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra3-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra3-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="False">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra4">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra4" data-type="Problem" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-SQL-problem-exercise-sql_social_query_extra4" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-SQL-problem-exercise-sql_social_query_extra4-problem-title"
data-problem-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra4" data-url="/courses/DB/SQL/SelfPaced/xblock/i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra4/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="i4x-DB-SQL-problem-exercise-sql_social_query_extra4-problem-title" aria-describedby="i4x://DB/SQL/problem/exercise-sql_social_query_extra4-problem-progress" tabindex="-1">
Q4
</h3>
<div class="problem-progress" id="i4x://DB/SQL/problem/exercise-sql_social_query_extra4-problem-progress"></div>
<div class="problem">
<div>
<span>
Find the number of students who are either friends with Cassandra or are friends of friends of Cassandra. Do not count Cassandra, even though technically she is a friend of a friend.
<br/>
<br/>
<b>Note:</b> Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1" id="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your SQL query here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra4_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q4" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra4" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra4">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra4-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra4-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra4-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="False">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-5" data-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra5">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="009befca35fc11e9bbb206cd177a39a0" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra5" data-type="Problem" data-course-id="DB/SQL/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-SQL-problem-exercise-sql_social_query_extra5" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-SQL-problem-exercise-sql_social_query_extra5-problem-title"
data-problem-id="i4x://DB/SQL/problem/exercise-sql_social_query_extra5" data-url="/courses/DB/SQL/SelfPaced/xblock/i4x:;_;_DB;_SQL;_problem;_exercise-sql_social_query_extra5/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="i4x-DB-SQL-problem-exercise-sql_social_query_extra5-problem-title" aria-describedby="i4x://DB/SQL/problem/exercise-sql_social_query_extra5-problem-progress" tabindex="-1">
Q5
</h3>
<div class="problem-progress" id="i4x://DB/SQL/problem/exercise-sql_social_query_extra5-problem-progress"></div>
<div class="problem">
<div>
<span>
Find the name and grade of the student(s) with the greatest number of friends.
<br/>
<br/>
<b>Note:</b> Your queries are executed using SQLite, so you must conform to the SQL constructs supported by SQLite.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1" id="input_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your SQL query here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-SQL-problem-exercise-sql_social_query_extra5_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q5" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra5" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-SQL-problem-exercise-sql_social_query_extra5">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra5-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra5-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-SQL-problem-exercise-sql_social_query_extra5-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="False">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
By exploring the course, you are agreeing to our Terms of Service and Privacy Policy. Please read them carefully.
© All Rights Reserved