Created
July 14, 2014 00:07
-
-
Save sdether/18232768dc5393460e40 to your computer and use it in GitHub Desktop.
A slightly altered SQL syntax would stop the needless repetition in parent/child table joins and make parsing, auto-completion a lot easier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- single result set (duplicated data, requires de-mux on client) | |
-- cannot auto-complete (table defined after field use) | |
SELECT p.person_id, p.fname, p.lname, a.address_id, a.street, a.zip, a.state, a.type | |
FROM person p | |
INNER JOIN address a | |
ON a.person_id = p.person_id | |
WHERE p.status = 1 | |
|person_id|fname|lname|address_id|street|zip|state|type| | |
--------------- | |
-- multiple result sets | |
-- auto-complete-able syntax (table defined before use) | |
FROM person p | |
SELECT p.fname p.lname | |
INNER JOIN address a | |
ON a.person_id = p.person_id | |
SELECT a.person_id, a.address_id, a.street, a.zip, a.state, a.type | |
WHERE p.status = 1 | |
|person_id|fname|lname| | |
|person_id|address_id|street|zip|state|type| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment