Knowee
Questions
Features
Study Tools

For the following tables: Student(studentId, studentName, address)            ('S01', 'Nguyen Van An', 'Hanoi'),            ('S02', 'Pham Tuan Anh', 'Hanoi'),            ('S03', 'Nguyen Minh Quan', 'Danang')Result(studentId, subjectId, score)            ('S01', 'J01', 8),            ('S01', 'S01', 7),            ('S02', 'J01', 3)Subject(subjectId, subjectName)            ('S01', 'SQL Basics'),            ('J01', 'Programming Java'),            ('N01', 'Programming C#')and a query:  SELECT s.studentName, r.subjectId, r.scoreFROM asql.Student s JOIN asql.Result r ON s.studentId =r.studentIdWhat is the result of the query?Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULLNguyen Van An Programming Java 8Nguyen Van An SQL Basics 7Pham Tuan Anh Programming Java 3Nguyen Van An J01 8Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULL

Question

For the following tables: Student(studentId, studentName, address)            ('S01', 'Nguyen Van An', 'Hanoi'),            ('S02', 'Pham Tuan Anh', 'Hanoi'),            ('S03', 'Nguyen Minh Quan', 'Danang')Result(studentId, subjectId, score)            ('S01', 'J01', 8),            ('S01', 'S01', 7),            ('S02', 'J01', 3)Subject(subjectId, subjectName)            ('S01', 'SQL Basics'),            ('J01', 'Programming Java'),            ('N01', 'Programming C#')and a query:  SELECT s.studentName, r.subjectId, r.scoreFROM asql.Student s JOIN asql.Result r ON s.studentId =r.studentIdWhat is the result of the query?Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULLNguyen Van An Programming Java 8Nguyen Van An SQL Basics 7Pham Tuan Anh Programming Java 3Nguyen Van An J01 8Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULL

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The result of the query will be:

Nguyen Van An J01 8 Nguyen Van An S01 7 Pham Tuan Anh J01 3

This is because the query is joining the Student and Result tables on the studentId field, and then selecting the studentName, subjectId, and score fields. The studentId 'S03' from the Student table does not have a matching entry in the Result table, so it is not included in the result.

Similar Questions

Given 3 tables, students(id, name) , courses(id, name) , grades(id, course_id, student_id, grade), for each student, get all the courses that he/she is enrolled in along with the grade he/she scored for each course. Order the result by the student name in ascending order and if there is a tie, break it with the course name in ascending order and if there is a tie break it with the grade in ascending order. Your query should output a table with the following columns (name, course, grade).

You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks.Grades contains the following data:Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there is more than one student with the same grade (8-10) assigned to them, order those particular students by their name alphabetically. Finally, if the grade is lower than 8, use "NULL" as their name and list them by their grades in descending order. If there is more than one student with the same grade (1-7) assigned to them, order those particular students by their marks in ascending order.Write a query to help Eve.

Consider following schema and write SQL for given statements.Student (RollNo, Name, DeptCode, City)Department (DeptCode, DeptName)Result (RollNo, Semester, SPI)1. List out the RollNo, Name along with SPI of Student.2. Display student name who got highest SPI in semester 1.3. Display the list of students whose DeptCode is 5, 6,7,10

You have created a query to list information from the students table:SELECT student_id, grade_point_average FROM students ORDER BY grade_point_averageA partial result is shown below:Student_idgrade_point_average12344.015473.918763.929343.897253.883203.420433.339483.0You want the results to look like this:Student_idgrade_point_average12344.015473.918763.929343.897253.8You begin revising your query:SELECT student_id, grade_point_average FROM students ORDER BY grade_point_average ______ 5What should you type in the blank space? (Please type your answer all in upper case. Example: SELECT)

Consider these following tables and only solve the query. Tables: 1) student: s_no (primary key), student_name, course_no (foreign key), age 2) courser-course-no (primary key), course-name

1/4

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.