The UPDATE Statement
The UPDATE Statement
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
DROP
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
DROP
column_1
1 indexes
2
3
4
+ + constraints
…
…
10
DROP vs TRUNCATE vs DELETE
DROP
column_1
1 indexes
2
3
4
+ + constraints
…
…
10
DROP vs TRUNCATE vs DELETE
DROP
- you won’t be able to roll back to its initial state, or to the last
COMMIT statement
use DROP TABLE only when you are sure you aren’t going to use the table
in question anymore
DROP vs TRUNCATE vs DELETE
TRUNCATE
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
column_1
1
2
3
4
+
…
10
DROP vs TRUNCATE vs DELETE
column_1
1
2
3
4
+
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1
1
2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1
2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 11
2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 11
2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 11 1
2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 11 1
2 12
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 11 1
2 12 2
3 TRUNCATE
4
…
10
DROP vs TRUNCATE vs DELETE
TRUNCATE
when truncating, auto-increment values will be reset
column_1 column_1
1 1
2 2
3 TRUNCATE 3
4 4
… …
10 10
DROP vs TRUNCATE vs DELETE
DELETE
DROP vs TRUNCATE vs DELETE
DELETE
removes records row by row
DROP vs TRUNCATE vs DELETE
DELETE
removes records row by row
DELETE
removes records row by row
column_1
1
2
3
4
…
10
DROP vs TRUNCATE vs DELETE
column_1
1
2
3 DELETE
4
…
10
DROP vs TRUNCATE vs DELETE
column_1 column_1
1
2
3 DELETE
4
…
10
DROP vs TRUNCATE vs DELETE
column_1 column_1
1 11
2 12
3 DELETE 13
4 14
… …
10 20
Next:
Next:
SQL Functions