다음을 통해 공유


DROP TABLE

적용 대상:예로 표시된 확인 Databricks SQL 예로 표시된 확인 Databricks Runtime

table이 EXTERNALtable않으면 table를 삭제하고 파일 시스템에서 table과 연관된 디렉터리를 제거합니다. table가 존재하지 않을 경우 예외가 발생합니다. table을(를) 삭제하려면 table에 대한 MANAGE 권한이 있어야 하거나, table의 소유자, schema의 소유자, catalog의 소유자 또는 table가 위치한 메타스토어의 소유자여야 합니다.

외부 table의 경우, 메타스토어 schema에 연결된 메타데이터 정보만 제거됩니다.

table 참조하는 모든 외래 키 제약 조건도 삭제됩니다.

table가 캐시된 경우, 그 명령어는 table 및 모든 종속성을 캐시에서 제거합니다.

참고 항목

관리되는 table가 Unity Catalog에서 제외되면, 해당 기본 데이터는 30일 이내에 클라우드 테넌트에서 삭제됩니다.

구문

DROP TABLE [ IF EXISTS ] table_name

매개 변수

예제

-- Assumes a table named `employeetable` exists.
> DROP TABLE employeetable;

-- Assumes a table named `employeetable` exists in the `userdb` schema
> DROP TABLE userdb.employeetable;

-- Assumes a table named `employeetable` does not exist.
-- Throws TABLE_OR_VIEW_NOT_FOUND
> DROP TABLE employeetable;
  Error: TABLE_OR_VIEW_NOT_FOUND

-- Assumes a table named `employeetable` does not exist,Try with IF EXISTS
-- this time it will not throw exception
> DROP TABLE IF EXISTS employeetable;