View the Exhibit and examine the structure of the PROMOTIONS table. Examine the following two SQL statements:
Which statement is true regarding the above two SQL statements?
A. statement 1 gives an error, statement 2 executes successfully
B. statement 2 gives an error, statement 1 executes successfully
C. statement 1 and statement 2 execute successfully and give the same output
D. statement 1 and statement 2 execute successfully and give a different output
D is correct.
Test set:
CREATE TABLE q120 (
promo_category VARCHAR2(30) NOT NULL,
promo_cost NUMBER(10,2) NOT NULL,
promo_begin_date DATE NOT NULL,
promo_end_date DATE NOT NULL
)
insert into q120 values(‘TV’,100,’01-JAN-2000′,’01-JAN-2019′);
insert into q120 values(‘TV’,88,’01-JAN-2019′,’02-JAN-2019′);
insert into q120 values(‘TV’,99,’01-JAN-2001′,’01-JAN-2019′);
select promo_category, sum(promo_cost)
from q120
where promo_end_date-promo_begin_date > 30
group by promo_category;
select promo_category, sum(promo_cost)
from q120
group by promo_category
having min(promo_end_date-promo_begin_date) > 30;