원하는 위치의 데이터 추출
: limit 시작번지, 개수;
- 시작번지부터 개수만큼 추출
- 보통 서식의 맨뒤에 위치!
< 0번지부터 3개 추출 >
mysql> select * from student limit 0,3;
+------+--------+------+---------+----------+-------+
| num | name | age | address | major | score |
+------+--------+------+---------+----------+-------+
| 1111 | 홍길동 | 23 | seoul | computer | 89 |
| 2222 | 강길순 | 24 | seoul | English | 87 |
| 3333 | 이순신 | 22 | Inchen | English | 57 |
+------+--------+------+---------+----------+-------+
3 rows in set (0.00 sec)
< 1~3등을 limit이용하여 출력 >
mysql> select * from student order by score desc limit 0,3;
+------+--------+------+---------+----------+-------+
| num | name | age | address | major | score |
+------+--------+------+---------+----------+-------+
| 6666 | 다래냥 | 1 | Inchen | computer | 100 |
| 8888 | 다래잉 | 26 | Inchen | computer | 99 |
| 5555 | 유관순 | 21 | suwon | Computer | 97 |
+------+--------+------+---------+----------+-------+
3 rows in set (0.00 sec)
'DB > 명령프롬프트 - mysql' 카테고리의 다른 글
[MySQL] student table - 테이블의 값을 다른 테이블로 옮기기 (4학년 친구들을 졸업) (0) | 2023.03.27 |
---|---|
[MySQL] product table - 테이블 생성 예제 (0) | 2023.03.27 |
[MySQL] product table - product테이블을 이용한 예제 (0) | 2023.03.27 |
[MySQL] 테이블의 행 여러 개 한번에 삭제하기 (0) | 2023.03.27 |
[MySQL] Database 확인 show, use, select (0) | 2023.03.26 |