MySQL - How to show only some selected columns from a table?
1. Using SQL Query:
You have a table with many columns but only need to see data from some of them. It’s better to create a view with those selected columns:
CREATE VIEW view_name AS
SELECT
col1,
col3,
col5
FROM
table_name;
The new view will show data from only some columns from the current table.
Or you can create a temporary table with selected columns:
CREATE TEMPORARY TABLE temp_table AS
SELECT
col1,
col3,
col5
FROM
table_name;
Then query data from the temporary table:
SELECT * FROM temp_table;
2. Using TablePlus GUI Tool:
- From the table view, find the column button at the bottom of the windows.
- Click on
Add a column
and choose the columns you want to see data from. - Click apply.
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.