Basic Join Part 2
Coddy SQL 여정의 기초 섹션에 포함된 레슨. 72개 중 44번째.
Join은 우리가 생성한 테이블에서도 사용될 수 있습니다. 중첩된 테이블을 join과 결합하려면 중첩된 쿼리를 이름으로 식별하기 위해 AS를 추가해야 합니다.
예를 들어:
SELECT table1.col1, table2.col2, ...
FROM table1, (SELECT * FROM table) AS table2
WHERE table1.id = table2.id챌린지
쉬움사용 가능한
table및columns:
<strong>grades</strong>:<strong>course_id</strong>,<strong>student_id</strong>,<strong>grade</strong><strong>students</strong>:<strong>id</strong>,<strong>name</strong>
각 학생의 평균 grade를 계산하고 각 학생의 이름과 평균 grade를 반환하세요.
columns 이름은 student, grade로 지정하세요.
평균을 소수점 이하 2자리로 ROUND 처리하고, result를 평균 grade의 오름차순으로 ORDER 정렬하세요.
직접 해보기
-- 이 목록을 작업에서 요청한 대로 이름이 변경된 두 출력 열로 채우세요
SELECT ____
FROM students,
(
-- 이 괄호 안에서 사람당 하나의 반올림된 평균을 생성하세요
SELECT student_id, ____
FROM grades
GROUP BY student_id
) AS avg_grades
-- 이제 공유 id 열을 기준으로 내부 결과를 외부 테이블에 다시 일치시키세요
WHERE ____
ORDER BY grade이 레슨에는 짧은 퀴즈가 포함되어 있습니다. 레슨을 시작해 문제를 풀고 진행 상황을 기록하세요.
기초의 모든 레슨
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns직접 연습해 보세요: SQL 플레이그라운드