Beautify/reformat the SQL script button partially working I am making my way through Murach's MySQL, 2nd Edition and I've encountered a bit of a speed bump.

When writing scripts to create tables, etc., I've always been able to write scripts and with the cursor at the end, press the Beautify/reformat the SQL script button and they get cleaned up.

With the following code, it only gets partially cleaned up (just the SELECT statement). The following code does what it's supposed to, but the Beautify/reformat button doesn't clean up everything in the editor. Any suggestions?

use ap;

drop procedure if exists test;

delimiter //

create procedure test()
begin
declare first_invoice_due_date date;

SELECT 
    MIN(invoice_due_date)
INTO first_invoice_due_date FROM
    invoices
WHERE
    invoice_total - payment_total - credit_total &gt; 0;

if first_invoice_due_date &lt; now() then
select 'Outstanding invoices overdue!';
elseif first_invoice_due_date = now() then
select 'Outstanding invoices are due today!';
else
select 'No invoices are overdue.';
end if;
end//
Bug:  NOW() is to the second.  You probably want CURDATE(), which is midnight this morning.  And would work nicely if first_invoice_due_date were declared DATE.

Avoid Cursors!  They are a speed bump.  Instead, learn how to write SQL statements that do everything all at once.

(As for beautifing, your code is prettier than most of the stuff on this forum!)