티스토리 뷰

프로그래밍/C#

mysql 테이블 생성하기

뽀로로친구에디 2018. 9. 21. 21:17

mysql 테이블 생성하기(create table) 


명령어 create table 이름 



실습예제 



MariaDB [opentutorials]> create table topic(

    -> id int(11) not null auto_increment,

    -> title varchar(100) not null,

    -> description text null,

    -> created datetime not null,

    -> author varchar(30) null,

    -> profile varchar(100) null,

    -> primary key(id));

Query OK, 0 rows affected (0.16 sec)


설명:

not null => 값이 없는 것을 허용하지 않는다.

null => 값이 없는것도 허용함. 

auto_increment => 1씩 자동 증가.

varchar(100) => 여기서 100은 100글자까지 제한함.

primary key(id) => id는 중복 안됨. 


댓글
최근에 달린 댓글
글 보관함
«   2024/05   »
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
Total
Today
Yesterday
    뽀로로친구에디
    최근에 올라온 글