테이블 생성

CREATE TABLE student (
	id INTEGER, 
	name TEXT,
	age INTEGER
);

위와 같이 테이블을 생성하면 아래와 같은 스키마가 형성됩니다.

id INTEGER
name TEXT
age INTEGER

삽입

INSERT INTO student (id, name, age) VALUES (1, 'Jane', 20);
INSERT INTO student (id, name, age) VALUES (2, 'Ami', 21);

조회

SELECT * FROM student;
id name age
1 Jane 20
2 Ami 21

변경

UPDATE student
SET age=22
WHERE id=1;

SELECT * FROM student;
id name age
1 Jane 22
2 Ami 21

colume 추가

ALTER TABLE student ADD COLUMN
major TEXT;

SELECT * FROM student;
id name age major
1 Jane 22 NULL
2 Ami 21 NULL
UPDATE student 
SET major='Computer engineering'
WHERE id=1;

SELECT * FROM student;
id name age major
1 Jane 22 Computer engineering
2 Ami 21 NULL

삭제

DELETE FROM student WHERE major IS NULL;

SELECT * FROM student;
id name age major
1 Jane 22 Computer engineering