• Insert
  • Update
  • Delete

Insert

INSERT INTO student VALUES(1, 'Nisim', 'Math');
INSERT INTO student VALUES(2, 'Shlomo', 'Biology');

NULL Value

INSERT INTO student VALUES(3, 'David', NULL);

Not All Values

INSERT INTO student(student_id, name)
VALUES(4, 'Gargamel');

Update

Comparison Operators

Operator Description
= equals
<> not equals
> greater than
< less than
>= greater than or equal
<= less than or equal

All Rows

UPDATE student
SET major = 'Music';

Single Row

UPDATE student
SET major = 'Music'
WHERE student_id = 2;

Several Rows

UPDATE student
SET major = 'Bio'
WHERE major = 'Biology';

Compound Conditional

UPDATE student
SET major = 'Math & Computer'
WHERE major = 'Math' OR major = 'Computer';

Multiple Changes

UPDATE student
SET name = 'Avi', major = 'undecided'
WHERE student_id = 2;

Delete

All Entries

DELETE FROM student;

A Single Entry

DELETE FROM student
WHERE student_id = 4;

Multiple Entries

DELETE FROM student
WHERE major = 'Biology';