Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL I need help with the following question. Thank you Consider the tablc struct

ID: 3705837 • Letter: S

Question

SQL

I need help with the following question. Thank you

Consider the tablc structurc shown in tha fiqure DATA TYTE NUMEER NUMBER (null) 2 inull) 3 (null) (null) 5 (null) (null) 7 (null) 8 inull) 9 (null) 10 (null) INVOICE ID 2VENDORID J INVOICE NUMBER VARClIAR2(50 BYTE) No INVOICE DATE 5INVOICE IO?AL NUMBER(9,2) PAYMENT TOTAL NUMBER9,2) CRFDIT TOTA No nul) No nul) (ul) No nul) Yes 0 NUMBERI9,2) NUMBER No nul) Yes [nul) 9 INVOICE DUE DATE DATE DAIE t 10 PAYMENT DATE at decle es ? veneb e andre ets t equal to the count o el t e o e in the invoioes able that have ? balance due a s g 9ater than or equa to cenai am ou t you cho e 1 ? ? 0 rt Then t scr pts ould isplay message 1 at 81 tes o V te en ac e-compatible SQL sc cxceed the amount you chesc meny o ces TTI ? paragraph Anal

Explanation / Answer

declare

v_Count NUMBER;

begin

select

COUNT(INVOICE_ID) into v_Count

from

INVOICES

where

INVOICE_ID IN (SELECT INVOICE_ID from INVOICES WHERE INVOICE_DUE_DATE> CURRENT_DATE AND PAYMENT_DATE IS NULL)

AND INVOICE_TOTAL>10000;--amount i have choosen

dbms_output.put_line('Number invoices greater than 10000 with balance due : '||v_Count);

end;

/