mysqlでif文っぽいのを使ってみました
SELECT
CASE WHEN column_id = 0 THEN word ELSE NULL END as first,
CASE WHEN column_id = 1 THEN word ELSE NULL END as second,
CASE WHEN column_id = 2 THEN word ELSE NULL END as third,
CASE WHEN column_id = 3 THEN word ELSE NULL END as fourth,
CASE WHEN column_id = 4 THEN word ELSE NULL END as fifth
FROM m_sample;
これでテーブルにデータを表示するのが楽でした