Some useful bits and pieces I've come across for using SQL, mostly the Teradata variant.
Using Teradata SQL: Create a table from another table or select statement
OK, this one is fairly basic for anyone who regularly uses SQL, but it's a neat trick if you're not familiar with it. Normally when you create a table you have to specify all the fields and their formats in the CREATE statement. Then you populate it with an INSERT
Using Teradata SQL: How to find the first or last record in a sequence
If your reading a lot of records from a database and you need to find the first or last record in a sequence, you can do this in MS SQL by using TOP 1, or in MySQL by using LIMIT 1. QUALIFY OVER PARTITION But TOP and LIMIT don't exist