2023-01-13 [TIL]

jenna·2023년 1월 14일
0

TIL/WIL

목록 보기
11/60

💡오늘 한 것

MYSQL

  • show databases;

  • use [DATABASE 이름];

  • show tables;

  • create table ex)
    create table tableName(
    id int(10) unsigned auto_increment not null primary key comment"table`s id",
    title varchar(512) not null comment "title",
    contents text not null comment "contents",
    count int(11) default 0 comment "count",
    created_at datetime default current_timestamp() comment "time");

  • insert into [table name]([column name1], [colunm name2], ...) values("[column name1's values]", "[column name2's values]", ...);

  • show create table [table name];

  • insert into [A테이블명] (title, contents, count, created_at) select title, contents, count, created_at from [A테이블명에 포함 될 테이블명]

  • ALTER TABLE [table] ADD INDEX [인덱스명]([인덱스 설정 컬럼01], [인덱스 설정 컬럼02])

  • select * from [table] order by [column] desc;

  • select count(*) from [table]

  • select count(column) from [table]

profile
https://github.com/jennaaaaaaaaa

0개의 댓글