select all count(1) minus union all select 1 only order by 1 limit 1 ; +-------+ | minus | +-------+ | 1 | +-------+ 1 row in set (0.00 sec)
The “ALL” in the “SELECT ALL” is actually the default – so you hardly ever see it.
“COUNT(1)” is mostly used with Oracle, where it may have a performance benefit over “COUNT(*)”. The result however is the same than “COUNT(*)”.
The “minus” and “only” are column aliases.
Last but not least, the “ORDER BY 1″ means, that we order by the first column.
Below the same slightly more readable:
select
count(*) as cnt
union all
select 1
order by cnt limit 1 ;
MariaDB [tt]> select * from vending_price where (price,product_id) = any (select max(price),product_id from vending_price group by product_id);
The “ANY/ALL” syntax can be very intuitive for some queries… Unluckliy not for this example %)
]]>MariaDB [tt]> select * from vending_price where (price,product_id) in (select max(price),product_id from vending_price group by product_id);]]>
select * from vending_price where (product_id,valid_from) = (0,'2010-01-09');
It is basically the same than the following, but more compact and easier to read.
select * from vending_price where product_id = 0 and valid_from = '2010-01-09';
]]>
CU!
]]>See you again after June 29th!
]]>You’ll need that knowledge for example to implement backups, data transfer and debugging.
]]>http://www.mysql.com/certification/candguide.html
In my experience you get the practical knowledge needed for the tests quite quickly by just using MySql every day. For the theoretical background however you need to study.
I got my certifications about a hundred years ago. In preparation I visited a course. At the course I actually got vouchers for the tests and the study guide. Shortly after that I passed the certificaton tests.
So, if you are serious about MySql certifications, get the study guide. A MySql course will help you save you time on perparations. And maybe even testing your knowledge with the questions on this page will help you on the way…
]]>