Difference between revisions of "MySQL"

Jump to navigation Jump to search
667 bytes added ,  08:14, 1 March 2011
Added "Events"
(→‎SHOW: Added some more)
(Added "Events")
Line 181: Line 181:
SELECT * FROM hware JOIN notes ON (id) GROUP BY model;   
SELECT * FROM hware JOIN notes ON (id) GROUP BY model;   
</source>
</source>
== Events ==
Events are scheduled occurrences, either where you're running a simple command, or a stored procedure.
If you need to create a stored procedure, use the MySQL Workbench software (http://dev.mysql.com/downloads/workbench/), its a lot easier than creating via command line.
To create an event...
<source lang="mysql">
CREATE EVENT do_update_cluster_stats ON SCHEDULE EVERY 1 DAY STARTS TIMESTAMP(CURRENT_DATE, '23:30:00') DO CALL update_cluster_stats();
</source>
You may need to enable the event scheduler
* <code> SET GLOBAL event_scheduler = 1; </code>
* The event_scheduler should now be visible in the process list (<code>show processlist</code>)


== SHOW etc==
== SHOW etc==

Navigation menu