Question: SQL / PL 1 . In the following code, identify examples of these procedural constructs: variable, conditional control statement, reusable / callable program unit (
SQLPL
In the following code, identify examples of these procedural constructs: variable, conditional control statement, reusablecallable program unit functions or methods assignment statement, and modular block structure.
DECLARE
vfirstname varchar;
vlastname varchar;
vfirstletter varchar;
BEGIN
SELECT firstname, lastname INTO vfirstname, vlastname
FROM students
WHERE studentid ;
vfirstletter : getfirstlettervlastname;
IF N vfirstletter THEN
DBMSOUTPUT.PUTLINE vlastname is between A and M;
ELSE
DBMSOUTPUT.PUTLINE vlastname is between N and Z;
END IF;
END;
a Variables?
b Conditional Control Statement?
c Reusablecallable program units?
d Assignment statement?
e Modular block structure?
Which of the following PLSQL blocks executes successfully? For the blocks that fail, explain why they fail.
a BEGIN
END;
b DECLARE
amount INTEGER;
END;
c DECLARE
BEGIN
END;
d DECLARE
amount INTEGER;
BEGIN
DBMSOUTPUT.PUTLINEamount;
END;
Create and execute a simple anonymous PLSQL block to accomplish the following:
Declares a variable vtimestamp of datatype DATE and populates it with the date that is six months from today using the DUAL table. Then, display the result on the screen.
Hint: use ADDMONTHSSYSDATE to get six months from today.
Example Output: if today is Jan. the result should be Jul
Write and run SQL statements to perform the following tasks by using the tables below:
dddonor
ddproject
ddstatus
ddpledge
ddpayment
a List each donor who has made a pledge and paid in a single lump sum payment ie where paymonths is equal to Include the donors first name, last name, pledge date, and pledge amount.
Write your SQL statement and include a screenshot of the result here.
b Display an unduplicated list of projects ID and name that have received pledges. Include only those projects with assigned pledges.
Write your SQL statement and include a screenshot of the result here.
c Show the number of pledges made by each donor. Include the donor ID first name, last name, and number of pledges.
Write your SQL statement and include a screenshot of the result here.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
