TIL - MYSQL 명령어

JS · 2020. 3. 23. 16:07

 

 

DB 목록 조회

 

show databases;


DB 생성

 

create database DB_Name;


DB 삭제

 

drop database DB_Name;


DB 접속

 

use DB_Name;

 


 

Table 목록 조회

 

show tables;


Table 생성

 

create table Table_Name(column1 datatype, column2 datatype, ...);

 

Table 삭제

 

drop table Table_Name;

 

Table 구조 보기

 

desc Table_Name;

 

 

Table 컬럼 추가

 

ALTER TABLE Table_name ADD column_name datatype; 

 

Table 컬럼명 변경

 

ALTER TABLE Table_name CHANGE column_name newColumn_name datatype;

 

Table 컬럼 타입 변경

 

ALTER TABLE Table_name MODIFY column_name newDatatype;

 

Table명 변경

 

ALTER TABLE Table_name RENAME NewTable_Name;

 

Table 컬럼 삭제

 

ALTER TABLE Table_name DROP COLUMN column_name;     

 


 

 

 

 

 

 

 

'JS' 카테고리의 다른 글

TIL - State, life cycle  (0) 2020.03.02
TIL - Component, props  (0) 2020.03.02
Today I Learned - Inheritance Patterns  (0) 2020.02.14
Today I Learned - Time complexity  (0) 2020.02.14
Today I Learned - Tree, Binary Search Tree  (0) 2020.02.10