What is SmartMYSQL?

Views

Create View

To create a new view, use the menu item Others -> View -> Create View.

A dialog will appear to request the view name. Once you have entered the name, a template for the view creation will be typed in a separate tab of the SQL Window. The template contains a command to drop the view in case it already exists and a command for the view creation where you have only to add your required selection of columns. You can use the WHERE clause to set selection conditions.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for views creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of  all queries present in the SQL window.

Alter View

To alter an existing view, select it in the Object browser and use the menu item Others -> View -> Alter View or press F6.

A template for the view alteration will appear in a separate tab of the SQL Window. The template contains a command to drop the view in case it already exists and a command for the view re-creation where you can specify source fields and their names in the target view. Use the WHERE clause if you need to set selection conditions.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for views creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of  all queries present in the SQL window.

Drop View

To drop an existing view, select it in the Object browser and use the menu item Others -> View -> Drop View. Then confirm the operation in the appeared dialog.

Rename View

To rename a view, select it in the Object browser and use the menu item Others -> View -> Rename View or simply click its name in the Object browser or press F2.

 

Store Procedure

Create Stored Procedure

To create a new stored procedure, use the menu item Others -> Stored Procedure-> Create Stored Procedure or use the database context menu.

Enter the procedure name in the appeared dialog, and SmartMYSQL will generate a template for your stored procedure in a separate tab of the SQL Window. Fill the template as necessary for you. Note that the template contains the command to drop the procedure before its creation is case it already exists. Also the most common options are displayed in this template.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for stored procedures creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

To create a useful Stored Procedure there must be some code in between the BEGIN .. END sequence, which can be a valid SQL statement. If there are more SQL statements here, then they should be separated by “;” (semicolon). Inside a Stored Procedure the delimiter is always “;”, here it cannot be changed. This explains why the delimiter needs to be changed (to “$$”) outside the Stored Procedure before creating it – if not SmartMYSQL (or any client) would ‘think’ that the SQL statement stops after the first line after “BEGIN” rather than “END”. When setting the DELIMITER to “$$” outside the Stored Procedure, SmartMYSQL will understand that the complete CREATE PROCEDURE statement is a single statement.

Also note that when you are executing this example you only create the Stored Procedure (the code is stored in the database itself). To execute it you must use the CALL SQL-statement like ‘call myproc()’ or ‘call myproc({parameter list})’.

Alter Stored Procedure

To alter an existing stored procedure, select it in the Object browser and use the menu item Others -> Stored Procedure -> Alter Stored Procedure or press F6.

A template for the procedure alteration will appear in a separate tab of the SQL Window. The template is similar to that used for a stored procedure creation.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for stored procedures creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

Drop Stored Procedure

To drop an existing stored procedure, select it in the Object browser and use the menu item Others -> Stored Procedure -> Drop Stored Procedure. Then confirm the operation in the appeared dialog.

 

Store Procedure With Cursor

Functions

Functions

Similar to store procedure , user-defined Functions are physically stored within a database in compiled form under a certain name. This allows you to share the functions between a number of programs. The distinct feature of functions is that they can return a value as a result of their work.

Functions are implemented in the 5.0 version of MySQL Server, and you can completely manage them with SmartMYSQL.

Create Function

To create a new function, use the menu item Others -> Function -> Create Function.

Enter the function name in the appeared dialog, and SmartMYSQL will generate a function template in a separate tab of the SQL Window. Fill the template as necessary for you. Note that the template contains the command to drop the function before its creation in case it already exists.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for functions creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

Alter Function

To alter an existing function, select it in the Object browser and use the menu item Others -> Function -> Alter Function or press F6.

A template for the function alteration will appear in a separate tab of the SQL Window.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for functions creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

Drop Function

To drop an existing function, select it in the Object browser and use the menu item Others -> Function -> Drop Function. Then confirm the operation in the appeared dialog.

Triggers

Create Trigger

To create a new trigger, switch to the Object Browser and select the table to which the trigger refers; then use the menu item Others -> Trigger -> Create Trigger.

Enter the trigger name in the appeared dialog, and SmartMYSQL will generate a trigger template in a separate tab of the SQL Window. Fill the template as necessary for you specifying the trigger event (BEFORE/AFTER INSERT/UPDATE/DELETE). Note that the template contains the command to drop the trigger before its creation is case it already exists.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for triggers creation/alteration, pressing both F5 and Shift+F5 keys leads to

execution of all queries present in the SQL window.

Alter Trigger

To alter an existing trigger, select it in the Object browser and use the menu item Others -> Trigger -> Alter Trigger or press F6.

A template for the trigger alteration will appear in a separate tab of the SQL Window. The template is similar to that used to create trigger ; it contains a command to drop the trigger in case it already exists and a command for the trigger re-creation.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for triggers creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

Drop Trigger

To drop an existing trigger, select it in the Object browser and use the menu item Others -> Trigger -> Drop Trigger. Then confirm the operation in the appeared dialog.

Rename Trigger

To rename a trigger, select it in the Object browser and use the menu item Others -> Trigger -> Rename Trigger or simply click its name in the Object browser or press F2.

Events

Create Event

To create a new event, use the menu item Others -> Event-> Create Event or use the database context menu.

Enter the event name in the appeared dialog, and SmartMySQL will present a template for your Event in a separate tab of the SQL Window. The template contains a ‘skeleton’ for defining three common types of Event:

  • Events that run only once
  • Events that run forever after creating
  • Events defined to start and/or stop at a specified time.

Uncomment the one that is closest to what you want and also uncomment any non-default options you want to use for the Event.

Use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for ‘stored programs’ creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

To create a useful Event there must of course be some code in between the BEGIN .. END sequence. That can be any valid SQL. If there are more SQL statements here they must be separated by “;” (semicolon). To conclude the Event code you must use a user-defined DELIMITER as the default SQL delimiter (;) is used between BEGIN… END internally in the Event code. More details about this in the paragraph on delimiters.

Alter Event

To alter an existing event, right-click it in the Object Browser or use the menu item Others -> Event -> Alter Event or press F6.

The current Event definition will appear in a separate tab of the SQL Window. Change what you want and next use the toolbar buttons or hotkeys to execute the queries. As editor tabs of a special kind are used for ‘stored programs’ creation/alteration, pressing both F5 and Shift+F5 keys leads to execution of all queries present in the SQL window.

If you want to use the template for Create Event you may also open the Create Event template and simply replace the word CREATE with ALTER.

The first option is easiest if you only want to change a few details of the Event code. If you want to completely redesign the schedule you may prefer the second option.

Drop Event

To drop an existing event, right-click it in the Object browser and use the menu item Others -> Event -> Drop Event. Then confirm the operation in the appeared dialogue.

Rename Event

To rename an event, right-click it in the Object browser and use the menu item Others -> Event -> Rename Event or simply click its name in the Object browser or press F2. ‘Rename Event’ is a special variation of ‘Alter Event’.

What is SmartMYSQL?

SmartMySQL is a next-generation GUI tool for the RDBMS MySQL. It  has unique advanced features help to Speed up SQL and PL/SQL development time, Optimize slow query and recommends optimal indexes and Debugs Production MySQL problems and provides fixes.

you can download smartmysql from download link

Download SmartMySQL