테이블을 본격적으로 다루는 방법을 알아본다.
데이터 찾기 시작!
select * from person;
update person set age=23 where name='이효리';
delete from person where name='이상순';
#내림차순
select age, name from celab order by age desc, name;
#오름차순
select age, name from celab order by age, name;
select age, name from celab where age=29 and sex='F' by age,
select * from celab where age between 20 and 40;
select * from celab where name in ('아이유','송강','강동원','차승원');
select * from celab where job_title like '%가수%';
+----+-----------+------------+------+------+-------------------+--------------------------+
| ID | NAME | BRITHDAY | AGE | SEX | JOB_TITLE | AGENCY |
+----+-----------+------------+------+------+-------------------+--------------------------+
| 1 | 아이유 | 1993-05-16 | 29 | F | 가수, 탤런트 | EDAM엔터테이먼트 |
| 2 | 이미주 | 1994-09-23 | 28 | F | 가수 | 울림엔터테이먼트 |
| 7 | 이수현 | 1999-05-04 | 23 | F | 가수 | YG엔터테이먼트 |
+----+-----------+------------+------+------+-------------------+--------------------------+
3 rows in set (0.00 sec)
select * from celab where job_title like '%가____%';
+----+-----------+------------+------+------+-------------------+------------------------+
| ID | NAME | BRITHDAY | AGE | SEX | JOB_TITLE | AGENCY |
+----+-----------+------------+------+------+-------------------+------------------------+
| 1 | 아이유 | 1993-05-16 | 29 | F | 가수, 탤런트 | EDAM엔터테이먼트 |
+----+-----------+------------+------+------+-------------------+------------------------+
1 row in set (0.00 sec)
select * from celab where job_title like '%,%' and not (job_title like '%탤런트%' or job_title like '%영화배우%');