Kolomnamen achterhalen (MySQL): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 9: | Regel 9: | ||
<pre> | <pre> | ||
drop table if exists tmp | drop table if exists tmp | ||
− | create temporary table tmp select column_name from information_schema.columns where table_name="tabelnaam" and table_schema="databasenaam"; | + | create temporary table tmp select column_name |
+ | from information_schema.columns | ||
+ | where table_name="tabelnaam" and table_schema="databasenaam"; | ||
</pre> | </pre> |
Versie van 14 jan 2016 13:46
Kolomnamen achterhalen is simpel:
select column_name from information_schema.columns where table_name="tabelnaam" and table_schema="databasenaam";
Of wegschrijven in een tijdelijke tabel:
drop table if exists tmp create temporary table tmp select column_name from information_schema.columns where table_name="tabelnaam" and table_schema="databasenaam";