본문 바로가기
카테고리 없음

mariaDB (mysql) 문법 정리

by 틴디 2020. 2. 22.
728x90
반응형

데이터 베이스에 접속

mysql -u root -p 데이터베이스 이름

 

테이블 생성

create table 테이블 명(

);

 

테이블 삭제

drop table 테이블 명;

 

테이블 전체 조회

shopw databases;

 

테이블 컬럼 조회 

desc 테이블명;

 

커밋

commit;

 

컬럼 데이터 타입과 조건 수정하기

alter table 테이블명 modify column 컬럼명 데이터타입 조건;

ex) alter table seller modify column seller_company char(10) not null;

 

foreign key 추가

alter table 테이블명 add foreign key(컬럼 명) references 테이블명(컬럼명);

 

테이블 명 수정

rename table 테이블 명 to 바꿀 테이블 명;

 

 

728x90
반응형

댓글