๐Ÿ–ฒ๏ธ Program/๐Ÿ“˜ Oracle

[ORACLE] SQL Developer : ์œ ์ € ํ…Œ์ด๋ธ” ํ•œ๋ฒˆ์— ์‚ญ์ œํ•˜๊ธฐ : DROP TABLE

์Œ์€์‘ 2022. 8. 19. 12:01
728x90
๋ฐ˜์‘ํ˜•
[ORACLE] SQL Developer
์œ ์ € ํ…Œ์ด๋ธ” ํ•œ๋ฒˆ์— ์‚ญ์ œํ•˜๊ธฐ
DROP TABLE
>> ์ƒํ™ฉ
์œ ์ €๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋ชจ๋“  ํ…Œ์ด๋ธ”์„ ํ•œ๋ฒˆ์— ์‚ญ์ œํ•˜๊ณ  ์‹ถ์Œ

>> ๋ฌธ์ œ
ํ•˜์ง€๋งŒ, SQL์—์„œ ์œ ์ €๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํ…Œ์ด๋ธ”์„ ํ•œ๋ฒˆ์— ๋ชจ๋‘ ์‚ญ์ œํ•˜๋Š” query๋ฌธ์€ ์—†์Šต๋‹ˆ๋‹ค.

>> ํ•ด๊ฒฐ๋ฐฉ๋ฒ•โœจ
SELECT๋ฌธ์œผ๋กœ ๋ชจ๋“  ํ…Œ์ด๋ธ”์„ ๋ถˆ๋Ÿฌ ์˜จ ํ›„,
์ด ์œ ์ €๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋ชจ๋“  ํ…Œ์ด๋ธ”์˜ DROP๋ฌธ์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ฟผ๋ฆฌ๋ฌธ์„ ์‹คํ–‰ํ•˜์—ฌ
ํ…Œ์ด๋ธ”์˜ DROP๋ฌธ์„ ๋ณต์‚ฌํ•˜์—ฌ์„œ ์ „์ฒด ์‚ญ์ œ ์ง„ํ–‰์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


>> ์ฟผ๋ฆฌ๋ฌธ
SELECT 'DROP TABLE "' || TABLE_NAME || '" CASCADE CONSTRAINTS;' FROM user_tables;

 

>> ์ฟผ๋ฆฌ๋ฌธ
SELECT 'DROP TABLE "' || TABLE_NAME || '" CASCADE CONSTRAINTS;' FROM user_tables;
↓ ์‹คํ–‰๊ฒฐ๊ณผ ↓

 

-- select๋ฌธ
SELECT 'DROP TABLE "' || TABLE_NAME || '" CASCADE CONSTRAINTS;' FROM user_tables;
-- DROP๋ฌธ
DROP TABLE "NOTICE" CASCADE CONSTRAINTS;
DROP TABLE "USERS" CASCADE CONSTRAINTS;
DROP TABLE "CATEGORY" CASCADE CONSTRAINTS;
DROP TABLE "BRAND" CASCADE CONSTRAINTS;

 

๐Ÿ”ต drop๋ฌธ ์‹คํ–‰์‹œ ์•„๋ž˜์™€ ๊ฐ™์ด ํ…Œ์ด๋ธ”์ด ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค.

 

 

728x90
๋ฐ˜์‘ํ˜•