For example I use this
select * from tab1;
every 5 minutes.
Is there a way to set up an alias p
so that I can just do
p
instead and that query is executed?
For example I use this
select * from tab1;
every 5 minutes.
Is there a way to set up an alias p
so that I can just do
p
instead and that query is executed?
You may want to use a stored procedure. You could call it by using:
CALL p;
This is how to create a stored procedure for the example in your question:
CREATE PROCEDURE p() SELECT * FROM tab1;
You can create a stored procedure and then call it like CALL p
.
This calls for a view, but in your case it isn't much shorter:
create view p as selecT * From tab1;
You'd use it as: select * from p
It does get more interesting with more complex queries though.