So imagine I have 3 related tables with 10 column in each namely users, settings, activitylogs. Obviously the users table
would have an id
column in it as its primary key, and the settings table
and activitylogs table
would have a user_id
column. Running the query below would return all the columns including the id
column in the users table
, user_id
column in tables settings
and activitylogs
.
select * from users
inner join settings on users.id = settings.user_id
inner join on activitylog on users.id = activitylogs.user_id
The problem is that I don't want to get the user_id
columns on other tables and I don't want to end up writing an extremely long query specifying all the columns that I want to get. So I thought I could create a query that kind of looks like this
select all except id from users
which can also be used together with joins.
select all except activitylogs.user_id, settings.user_id from users
inner join settings on users.id = settings.user_id
inner join activitylogs on users.id = activitylogs.user_id
which would actually return all the columns except what was explicitly specified.
- How should I do this? I mean what are the programming languages that I need to use or do I have to edit mysql's source code or do something like that?
- Is it going to be legal to do this? because I want to do this while avoiding a lawsuit.
If you have anything to say related to this, or if you can point me to any blog posts related to this, please do so.