ORACLE

SQL 문장 – UPDATE 문

oracle

SQL 문장 – UPDATE 문

update 테이블명
set 변경할칼럼명1 =, 변경할칼럼명2 =
where 조건

SQL 문장 – UPDATE 문 예제

CREATE TABLE MEMBER(
    userid varchar2(12) primary key,            -- 아이디
    passwd varchar2(12) not null,               -- 암호
    username varchar(30) not null,              -- 이름
    tel varchar2(20),                           -- 전화번호
    gender varchar2(3),                         -- 성별
    job varchar2(30),                           -- 직업
    intro varchar2(4000),                       -- 자기소개
    indate date default sysdate                 -- 가입일  
);

INSERT INTO member (userid,passwd,username,tel,gender,job,intro) 
VALUES ('Karutabaka','1234','Ayase Chihaya','090-1231-5646','여','학생','karutasuki');

INSERT INTO member (userid,passwd,username,tel,gender,job,intro) 
VALUES ('Tensai','1234','Mashima Taichi','090-1231-2331','남','학생','Chihayaga Suki');

INSERT INTO member (userid,passwd,username,tel,gender,job,intro) 
VALUES ('Megane','meijin','Yataya Arata','080-2123-1311','남','학생','Sukiya');
commit;

update member 
set passwd = 'karuta', job = '선생님', intro = '안녕하세요'
where userid = 'Karutabaka' 
and passwd = '1234'; 
최신글