I made partition my 300MB table and trying to make select query from p0
partition with this command
SELECT * FROM employees PARTITION (p0);
But I am getting following error
ERROR 1064 (42000): You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near '(p0)' at line 1
How to write select query to get data from specific partition?
To select last two rows, use ORDER BY DESC LIMIT 2.
Getting MySQL row count of all tables in a specific database First, get all table names in the database. Second, construct an SQL statement that includes all SELECT COUNT(*) FROM table_name statements for all tables separated by UNION . Third, execute the SQL statement using a prepared statement.
Actually since MySQL 5.6 the supported syntax is:
SELECT * FROM table PARTITION (partitionName);
The correct form of the query
is as below it works for me fine.
select * from employees partition (`p0`);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With