table 생성
mysql> create table event(
-> e_no int(8)not null auto_increment,
-> e_id char(200)not null,
-> e_pw varchar(250)not null,
-> e_hp char(11)not null,
-> e_mail char(100) null,
-> e_vip char(10) null,
-> e_sw enum('window','office','xbox')not null default 'window',
-> e_date timestamp not null default current_timestamp,
-> e_del datetime null default '0001-01-01 01:00:00',
-> primary key(e_no,e_id),
-> unique key(e_id)
-> );
table data 입력 insert
insert into event (e_no,e_id,e_pw,e_hp,e_mail,e_vip,e_sw,e_date,e_del) values ('0','hong',sha('a12345'),'01012345678','hong@nate.com','','xbox','2022-07-04 15:14:00',null);
Query OK, 1 row affected (0.00 sec)
결과값
mysql> desc event;
+--------+--------------------------------+------+-----+---------------------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------------------------+------+-----+---------------------+-------------------+
| e_no | int | NO | PRI | NULL | auto_increment |
| e_id | char(200) | NO | PRI | NULL | |
| e_pw | varchar(250) | NO | | NULL | |
| e_hp | char(11) | NO | | NULL | |
| e_mail | char(100) | YES | | NULL | |
| e_vip | char(10) | YES | | NULL | |
| e_sw | enum('window','office','xbox') | NO | | window | |
| e_date | timestamp | NO | | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
| e_del | datetime | YES | | 0001-01-01 01:00:00 | |
+--------+--------------------------------+------+-----+---------------------+-------------------+
9 rows in set (0.00 sec)
select count(*) from 테이블명 where 필드명 < 값;
select count(*) from 테이블명 where 필드명 < 500 and taddr like '%찾는단어%';
728x90
'Database > MySQL' 카테고리의 다른 글
[Mysql] 데이터 합계, 내림차순, 오름차순 정렬 등 (0) | 2022.07.05 |
---|---|
[Mysql] 데이터 backup (0) | 2022.07.04 |
[MySql] alter table 테이블명 modify 추가할 필드명 text not null; (0) | 2022.07.04 |
[Mysql] 데이터 수정하기 update (0) | 2022.07.04 |
MySQL (0) | 2022.06.30 |
댓글