Let’s imagine a scenario where you have a MySQL table called users and there’s a column called secret which holds a secret token for the associated users. How would you prevent this column from not being there when someone queries everything (i.e SELECT * query) from this table? Well, one way is to explicitly specify each column in the SELECT query except the secret column. Or if you’re using MySQL 8.0.23 and onwards, you could define the secret column as “invisible”.
CREATE TABLE users ( secret TINYTEXT INVISIBLE ) ENGINE = InnoDB; Or when you’re altering the table.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.