|
|
|
|
|
by richiebful1
1239 days ago
|
|
A database system could implement a feature that automatically uses the foreign key to join to a table. Maybe some RDBMS out there does this. For example, you have a many to one relationship between posts and users. Instead of this: select *
from user as u
join post as p
on p.user_id = u.user_id;
You could do: alter table post
add constraint fk_user_id foreign key (user_id)
references user.user_id;
select *
from user as u
left referent join post as p;
Any good sql auto-completer will also look up the foreign key information and auto-generate the on clause for you as well. Redgate SQL Prompt (mssql only) is one of the best tools out there for this reason |
|
https://www.postgresql.org/docs/current/queries-table-expres....