4 ms·
You mean shorter than "JOIN fktable USING (key_name)"? (Granted, that implies both columns have the same name iirc)
by jimktrains2 12y ago
You mean shorter than "JOIN fktable USING (key_name)"?
(Granted, that implies both columns have the same name iirc)
- twic 12y agoActually, yes. JPQL, the generally SQL-like query language in the Java Persistence API, lets you write joins through foreign key references (as most joins are, although of course not all) as if they were object property references. So instead of: select u.user_id from User u join Company c using (company_id) join Country k using (country_id) where k.code = 'br' You would write something like: select u from User u where u.company.country.code = 'br' That's pretty neat. I wish i could do that in SQL. If you want to fetch data from joined entities, then you still need to name them in an explicit join, but it's still easier than in SQL: select u, k.code from User u join u.company.country k where u.creation_date = current_date
- Pxtl 12y agoMicrosoft's Entity Framework is similar, except that they put the Select at the end so that the editor is aware of the availability of relevant variables when you're writing the "select" part of the statement. Such simple changes that will never be part of the SQL standard.