This is a collection of some of the code that I use daily, so instead of constantly googling the syntax, I can just refer to this page and copy over to my code.
System.out.println("start stopwatch");
long t = System.currentTimeMillis();
// code to be tested for speed
System.out.println("code took " + (System.currentTimeMillis() - t) + "ms to run");
Collection of SQL snippets
CREATE INDEX user_username_asc ON user(username ASC);
DECLARE @variable VARCHAR(32)
INSERT INTO comment (column) values ('comment')
SET @variable = SCOPE_IDENTITY()
UPDATE article SET comment_id=@variable WHERE article.id = 123;
CAST('2020-12-31' AS DATETIME)
CONVERT(date, '20190509', 112)
GETDATE()
UPDATE target
SET target.comment_id = origin.comment_id
FROM target
INNER JOIN (
SELECT *
FROM ???
WHERE as_of = convert(date, '20190509', 112)
) origin on (origin.id = target.id)
where target.comment_id is null
and target.status != 2;