Skip to content

Instantly share code, notes, and snippets.

@mikeblas
mikeblas / SQLBooks.md
Last active April 9, 2024 14:29
list of SQL books
@mikeblas
mikeblas / skill_rank.md
Created November 24, 2023 19:44
exponential skill ranking

This might kind of seem harsh, but I think it takes into account that there's a lot of knowledge to have in most subjects, and most people take very high levels of knowlege for granted. When I recruit, and when I train people on hiring, I propose a very curious rating on a zero to ten scale:

  1. don't know how to spell it
  2. heard of it
  3. wandering around the bookstore to find a book on it
  4. did some tutorials, half a clue
  5. used it a bit
  6. familiar with most stuff about it
  7. did a very substantial project with it
@mikeblas
mikeblas / sqlsills.md
Created December 4, 2022 02:59
SQL Skills

"SQL skills" is a bit of a trigger phrase for me because it's very much overloaded, since SQL work ranges from developing a database (that is, writing the database server itself) through designing a database (using a DBMS someone else wrote to implement a data system), through writing queries and doing DBA work. People tend to lump these things together without carefully understanding what job they're looking for (or what candidate they want to hire) or how to best build a data team or ...

Anyway! Since you asked specifically about querying, I can leave out all the rest:

A beginner:

  • Knows the tool. Can setup and use a command-line tool, a GUI tool, knows a couple of each at least. Can diagnose connection problems. Understands how to save, load, manipulate files.
@mikeblas
mikeblas / MySQLSampleData.py
Created September 15, 2022 18:17
generate some sample data for a Reddit question about MySQL Performance
import random
def build_data(tablename, filename, rows):
with open(filename, 'w') as outfile:
outfile.write(f"INSERT INTO {tablename} (id, type, category_id) VALUES\n")
type_list = ['pet', 'plant', 'book', 'snack', 'tool']
for x in range(rows):
if x > 0:
outfile.write(",\n")
@mikeblas
mikeblas / SampleData.md
Last active March 12, 2024 14:23
FAQ: Where can I get sample data?

It's not so hard to find sample data and data sources to use for interesting side-projects, or just for practicing writing SQL.

In-product sample data

Most DBMSes come with sample databases. You can write lots of interesting queries against them, and usually a tutorial accompanies the database in the documentation.

@mikeblas
mikeblas / in_flight_queries.sql
Created November 27, 2020 15:52
SQL Server: show currently running queries by CPU time
-- in flight queries by CPU time
-- author: mike@blaszczak.com
-- Date: 2020-11-27
SELECT s.session_id,
DB_NAME(r.database_id) as DBName,
r.status,
r.blocking_session_id 'Blk by',
r.wait_type,