{"id":7022,"date":"2023-03-02T18:07:47","date_gmt":"2023-03-02T18:07:47","guid":{"rendered":"https:\/\/www.goodacademic.com\/blog\/questions\/mysql-question\/"},"modified":"2023-03-02T18:07:47","modified_gmt":"2023-03-02T18:07:47","slug":"mysql-question","status":"publish","type":"questions","link":"https:\/\/www.goodacademic.com\/blog\/questions\/mysql-question\/","title":{"rendered":"MySQL Question"},"content":{"rendered":"<div class=\"col-sm-12 messageContent\">\n <b>Learning Goal: <\/b>I&#8217;m working on a mysql multi-part question and need the explanation and answer to help me learn.<\/p>\n<p>Needing a code and spool output for this as well. It uses the same database as the last project you did for me, but I attached them again in case. The spool output is the most important. Here are the instructions:<\/p>\n<ol>\n<li>SPOOL your output to c:\\folder\\project6spool.txt<\/li>\n<li>Set SERVEROUTPUT ON FORMAT WRAPPED to use the<br \/>DBMS_OUTPUT package and preserve leading spaces<\/li>\n<li>Declare variables for the entire record using %ROWTYPE<br \/>Add a variable to remember last ROOMNUM<br \/>Add accumulators for subtotal and grandtotal<\/li>\n<li>Add procedures for HEAD_OF_FORM, FORM_BREAK, and END_OF_FORM<\/li>\n<li>Use FOR\/IN to read all records from DDI.LEDGER_VIEW<\/li>\n<li>The SELECT statement should read all fields from DDI.LEDGER_VIEW<br \/>where REGDATE &lt; &#8217;08-JUN-15&#8242; (Monday \u00e2\u20ac\u201c Friday for Week One)<br \/>order by ROOMNUM and REGDATE<\/li>\n<li>Read each record using LOOP\/END LOOP<br \/>Use IF\/ELSEIF\/ELSE\/END IF to decide which procedures to use based on Last_room<br \/>Print ROOMNUM, REGDATE, REGID, Name (FIRSTNAME || &#8216; &#8216; || LASTNAME), ROOMRATE<br \/>using TO_CHAR to format REGDATE as &#8216;MM\/DD\/YYYY&#8217; and ROOMRATE as &#8216;999,999.00&#8217;<\/li>\n<li>Be sure to add a FORM_BREAK and an END_OF_FORM after the END LOOP<\/li>\n<li>Use DBMS__OUTPUT.OUTPUT_LINE to print the values for each field<br \/>concatenate FIRSTNAME and LASTNAME into a single name and use&#8221;<br \/>TO_CHAR to format dates as &#8216;MM\/DD\/YYYY&#8217; and currency as &#8216;999,999.00&#8217;<\/li>\n<li>Compile and run the procedure<\/li>\n<li>Close spool<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learning Goal: I&#8217;m working on a mysql multi-part question and need the explanation and answer to help me learn. Needing a code and spool output for this as well. It uses the same database as the last project you did for me, but I attached them again in case. The spool output is the most [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"disciplines":[853],"paper_types":[],"tagged":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/7022"}],"collection":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions"}],"about":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/types\/questions"}],"author":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/comments?post=7022"}],"version-history":[{"count":0,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/7022\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/media?parent=7022"}],"wp:term":[{"taxonomy":"disciplines","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/disciplines?post=7022"},{"taxonomy":"paper_types","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/paper_types?post=7022"},{"taxonomy":"tagged","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/tagged?post=7022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}