CASE 3

[MySQL] ERD 대학수강프로그램 - 4. 테이블 업데이트 (update, case, if, modify)

1. at_mid, at_final, at_attend, at_homework 값 업데이트 (40/40/10/10) update attend set at_homework = 8 where at_num=1; update attend set at_homework = 5 where at_num=2; update attend set at_homework = 2 where at_num=3; update attend set at_homework = 10 where at_num=4; update attend set at_homework = 7 where at_num=5; update attend set at_homework = 5 where at_num=6; update attend set at_homework = ..

[MySQL] SQL 내장함수 : 논리함수 ( if , case ~ when ~then )

if 문 if문 : if(조건식, 참, 거짓); 다중 if문 : if(조건식, true, if(조건식, true, false)); 예시 ) at_repetition에 ( at_score =F 이거나 at_attend update attend set at_repetition = -> if(at_score = 'F' or at_attend where at_term = 1; 예시) at_score가 'A' 또는 'B'일 경우 'p'아니면 'f'를 넣으세요 mysql> update attend set at_pass = -> if(at_score = 'A' or at_score = 'B', 'p' , 'f' ); case ~ when ~then 문 case when 조건1 then 값1 when 조건2 then ..

[MySQL] ERD 수강관리프로그램 3.업데이트 (update, if, case)

1. attend 테이블의 수강년도(at_year) 을 2023으로 변경 mysql> update attend set at_year = 2023; Query OK, 16 rows affected (0.00 sec) Rows matched: 16 Changed: 16 Warnings: 0 mysql> select * from attend; +--------+------------+-------------+---------+---------+--------+----------+-----------+-------+---------------+----------+ | at_num | at_std_num | at_co_code | at_year | at_term | at_mid | at_final | at_att..