250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- __len__
- node.js
- MySQL
- count()
- fileinput
- CSS
- choice()
- decode()
- zipfile
- __getitem__
- glob
- items()
- locals()
- JS
- 파이썬
- HTML
- __sub__
- remove()
- fnmatch
- shutil
- MySqlDB
- __annotations__
- inplace()
- View
- mro()
- Database
- shuffle()
- discard()
- 오버라이딩
- randrange()
Archives
- Today
- Total
흰둥이는 코드를 짤 때 짖어 (왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!)
(MySQL) 기초 문법(테이블 복사) 본문
728x90
반응형
orders 테이블
select * from orders;
insert로 복사
create table orders2(
no int not null,
userid varchar(20) not null,
product varchar(100) not null,
cnt int default 1,
regdate datetime default now(),
foreign key(userid) references member(userid)
);
먼저 orders와 컬럼이 똑같은 orders2 테이블을 생성한다.
insert into orders2(select * from orders);
select * from orders2;
orders에 존재하는 데이터를 모두 복사하여 orders2에 저장하였다.
create로 복사
create table orders3(select * from orders);
select * from orders3;
orders3 테이블을 생성할 때 orders 테이블에 존재하는 데이터를 모두 복사하였다.
728x90
반응형
'MySQL' 카테고리의 다른 글
(MySQL) 기초 문법(뷰) (0) | 2023.03.21 |
---|---|
(MySQL) 사용자 (1) | 2023.03.21 |
(MySQL) 기초 문법(문자열 함수) (0) | 2023.03.20 |
(MySQL) 기초 문법(서브 쿼리) (0) | 2023.03.20 |
(MySQL) 기초 문법(유니온) (1) | 2023.03.20 |
Comments