| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
- 삼항 연산식
- 오버로딩
- 상속
- 자바
- 문자열
- Integer.MIN_VALUE
- 인터페이스
- interface
- 중첩for문
- javascript
- Integer.MAX_VALUE
- 2차원 배열
- 이중 배열
- rs.next()
- Break
- Else If
- scanner
- jsp
- 다형성
- for문
- If
- arraylist
- extends
- 배열
- 상수
- super()
- 메소드
- 삼항 연산
- docker
- 이클립스
- Today
- Total
개발로드
[MySQL]delete/update 기초 연습 예제 본문
use jointestdb;
1) porderTBL테이블에서 custid가 'c1'인 자료를 모두 삭제
delete from pordertbl where custid='c1';
2) porderTBL 테이블의 모든 자료를 삭제
delete from pordertbl;
3) porderTBL 테이블 자체를 제거
drop table pordertbl;
4) customerTBL 테이블에서 gender가 '남'인 자료만 삭제
delete from customertbl where gender='남';
5) customerTBL 테이블에서 address가 '서울 강남'인 자료들을 모두 '강남'으로 수정
update customertbl set address = '강남' where address like '서울 강남';
6) productTBL 테이블에서 price를 10%씩 인상하기
update producttbl set price = price*1.1;
7) productTBL 테이블에서 price가 2000이상인 제품들의 region을 '대구'로 변경
update producttbl set region = '대구' where price >=2000;
8) productTBL 테이블에서 pname이 '사과' 또는 '망고'인 데이터를 삭제하기
delete from producttbl where pname in ('사과','망고');
9) productTBL 테이블의 데이터를 모두 삭제 하기
delete from producttbl;
10) productTBL 테이블을 완전 삭제하기
drop table producttbl;
마치며
MySQL의 delete와 update의 간단한 예제를 풀어보았습니다.
여유가 되신다면 제 GitHub에 오셔서 좋은 코드들을 구경해주세요!

https://github.com/gimpo5975?tab=repositories
gimpo5975 - Overview
gimpo5975 has 2 repositories available. Follow their code on GitHub.
github.com
'SQL' 카테고리의 다른 글
| [MySQL]JOIN 기초 연습 예제_2 (0) | 2024.02.13 |
|---|---|
| [MySQL]JOIN 기초 연습예제 (0) | 2024.02.08 |
| [MySQL]select 기초 연습예제 (1) | 2024.02.06 |
| [MySQL]온라인 쇼핑 주문 목록 데이터베이스 만들기 (0) | 2024.02.01 |