|
- COUNT(expr) : GROUP BY ·Î ¹ÀÎ ºÎºÐ¿¡ ´ëÇÑ Çհ踦 ¹ÝȯÇÑ´Ù.
- ¿¹ : select student.student_name,COUNT(*)
from student,course
where student.student_id=course.student_id
GROUP BY student_name;
- Âü°í : ÇÑ°³ÀÇ Å×ÀÌºí¿¡ ´ëÇØ, WHERE ÀýÀÌ ¾ø´Â °æ¿ì COUNT(*) °¡ ÃÖÀûÈ µÇ¾î ÀÖ¾î ¸Å¿ì ºü¸£´Ù.
- ¿¹ : select COUNT(*) from student;
- AVG(expr) : GROUP BY ·Î ¹ÀÎ ºÎºÐ¿¡ ´ëÇÑ Æò±Õ°ªÀ» ¹ÝȯÇÑ´Ù.
- ¿¹ : select student_name, AVG(test_score)
from student
GROUP BY student_name;
- MIN(expr) : GROUP BY ·Î ¹ÀÎ ºÎºÐ¿¡¼ ÃÖ¼Ò°ªÀ» ¹ÝȯÇÑ´Ù.
- MAX(expr) : GROUP BY ·Î ¹ÀÎ ºÎºÐ¿¡¼ ÃÖ´ë°ªÀ» ¹ÝȯÇÑ´Ù.
- ¿¹ : select student_name, MIN(test_score), MAX(test_score)
from student
GROUP BY student_name;
- Âü°í : expr ¿¡´Â ¹®ÀÚ¿ÀÌ µé¾î°¥¼ö ÀÖÀ¸¸ç, ±×·²°æ¿ì ¹®ÀÚ¿ ±æÀÌÀÇ ÃÖ¼Ò/ÃÖ´ëÀÎ °ªÀ» ¹ÝȯÇÑ´Ù.
- SUM(expr) : GROUP BY ·Î ¹ÀÎ ºÎºÐ¿¡ ´ëÇÑ Çհ踦 ¹ÝȯÇÑ´Ù.
- ÁÖÀÇ : ÇØ´çÇÏ´Â row °¡ Çϳªµµ ¾øÀ»°æ¿ì NULL À» ¹ÝȯÇÑ´Ù. |