0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Relational Database, レコードやテーブルの削除3コマンドについて整理

Last updated at Posted at 2024-04-13

テーブルのレコード削除のコマンドは3種あります。
DELETE, DROP, TRUNCATE です。それぞれの用途について解説および整理します。

DELETE

構文

DELETE FROM table_name [WHERE CLAUSE]

説明

(条件を指定して)レコードを削除する
DML

DROP

構文

DROP TABLE table_name

説明

テーブル自体を削除する
DROP は TABLE 以外にも, DROP INDEX, DROP CONSTRAINT, DROP CLUSTER, DROP VIEW, DROP PROCEDURE, DROP FUNCTION, DROP PACKAGE, DROP TRIGGER, DROP SEQUENCE,DROP SYNONYM, DROP ALIAS, DROP USER, DROP LOGIN, DROP TYPE 等, DB の様々な要素の削除に使われるコマンドで、TABLE はその一部である
DDL

TRUNCATE

構文

TRUNCATE TABLE table_name

説明

テーブルの必ず全行を高速に削除する
DDL

参考

技術評論社 SQLポケットリファレンス[改訂第4版] 朝井淳 著

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?