tg-me.com/sql_for_qa/172
Last Update:
Даны следующие таблицы:
Students| StudentID | Name | Age | Gender |
Courses
|-----------|-----------|-----|--------|
| 1 | John | 20 | Male |
| 2 | Jane | 22 | Female |
| 3 | Mark | 21 | Male |
| 4 | Sarah | 23 | Female |
| 5 | Michael | 20 | Male || CourseID | CourseName | Credits |
Enrollments
|----------|------------------|---------|
| 101 | Mathematics | 3 |
| 102 | Physics | 4 |
| 103 | Chemistry | 3 |
| 104 | English | 2 |
| 105 | History | 3 |
| EnrollmentID | StudentID | CourseID |Какой из следующих SQL запросов отберет всех студентов женского пола, записанных на курс "Mathemetics"?
|--------------|-----------|----------|
| 1 | 1 | 101 |
| 2 | 2 | 101 |
| 3 | 3 | 102 |
| 4 | 4 | 101 |
| 5 | 1 | 103 |
| 6 | 2 | 105 |
| 7 | 3 | 104 |
| 8 | 4 | 102 |
| 9 | 5 | 101 |
| 10 | 5 | 103 |
A)
SELECT Name FROM Students WHERE Gender = 'Female' AND StudentID IN (SELECT StudentID FROM Enrollments WHERE CourseName = 'Mathematics')
B) SELECT Name FROM Students JOIN Enrollments ON Students.StudentID = Enrollments.StudentID WHERE Gender = 'Female' AND CourseName = 'Mathematics'
C) SELECT Name FROM Students WHERE Gender = 'Female' AND StudentID = (SELECT StudentID FROM Enrollments WHERE CourseName = 'Mathematics')
D) SELECT Name FROM Students JOIN Enrollments ON Students.StudentID = Enrollments.StudentID WHERE Gender = 'Female' AND CourseID = 101
BY SQL для тестировщика
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Share with your friend now:
tg-me.com/sql_for_qa/172