drop table sales;
create table sales
( product_id number(10) not null,
customer_id number(10) not null,
quantity_sold number(10,2) not null,
price number(10,2) not null);
insert into sales(product_id, customer_id, quantity_sold, price) --임의로 데이터 입력하기
values(1101, 108, 7, 25000);
insert into sales(product_id, customer_id, quantity_sold, price) --임의로 데이터 입력하기
values(1200, 133, 25, 17000);
insert into sales(product_id, customer_id, quantity_sold, price) --임의로 데이터 입력하기
values(1304, 251, 31, 20000);
drop table mysales;
create table mysales(product_id, customer_id, quantity_sold, price_)
as
select product_id, customer_id, quantity_sold, price from sales
where 1 = 2;
select * from mysales;
desc mysales;
실행결과:
PRODUCT_ID NOT NULL NUMBER(10)
CUSTOMER_ID NOT NULL NUMBER(10)
QUANTITY_SOLD NOT NULL NUMBER(10,2)
PRICE_ NOT NULL NUMBER(10,2)
실행결과를 통해 NOT NULL 제약이 옮겨짐을 알 수 있으며
또한 mysales 테이블 생성 당시 1=2를 내걸은 것은 sales에서 mysales로 옮겨지는 데이터는 컬럼 외 없음을 의미함
(1=2는 성립 불가능하므로)
답 : A, C