Let us consider a table representing employee data with a few columns, and, of course, their salary details as well.
It is not wise to expose this table to all querying entities since there is sensitive data that makes sharing the contents problematic.
In real time, there are VIEWS that can come in handy. You can create a VIEW with only the columns that need to be exposed and share that VIEW or permit read operation of that VIEW to users across various departments of the organization.
In MySQL, the syntax to create a VIEW is as below:
AS SELECT * FROM
The above syntax can be customized as needed. You must replace the * with the columns that you need to ensure that the sensitive data is not part of the view and thereby preventing it from being exposed. Of course, you need not permit anyone to access the
CREATE VIEW EMPLOYEE_DETAILS_VIEW AS SELECT EMP_ID, EMP_NAME, EMP_DEPT, EMP_DOB FROM EMPLOYEE_DETAILS
And yes, there are other conditional CREATE options that you can always explore.