I have a two tables:
people_en: id, name
people_es: id, name
(please, dont bother about normalization. the design is normalized. the tables are
@clickstefan, you will have problems with two or more users trying to execute your script at the same time. The second user will get error message 'View vw_myproc already exists' for the line:
SET @select = concat('CREATE VIEW vw_myproc as SELECT * FROM ', lang, ' limit 3');
The solution is temporary table - it exists for the lifetime of current connection only, and users may simultaneously create temporary tables with the same name. So, code may looks like:
DROP TABLE IF EXISTS vw_myproc;
SET @select = concat('CREATE TEMPORARY TABLE vw_myproc AS SELECT * FROM ', lang, ' limit 3');