SQL Tricks That You Didn’t Think Were Possible
SQL is one of the only ever Successful, mainstream, and general-purpose 4GL(Fourth-Generation programming Language) From early days onwards, programming language designers had this desire to design languages in which you tell the machine WHAT you want as a result, not HOW to obtain it. For instance, in SQL, you tell the machine that you want to “connect” (JOIN) the user table and the address table and find the users that live in Ghana. You don’t care HOW the database will retrieve this information (e.g. should the users table be loaded first, or the address table? Should the two tables be joined in a nested loop or any other method? Should all data be loaded in memory first and then filtered for Ghanaian users, or should we only load Ghanaian addresses in the first place? EVERYTHING IS A TABLE • This is the most trivial of tricks, and not even really a trick, but it is fundamental to a thorough understanding of SQL...