Working with
SQL.
I use SQL to structure relational data, write queries, and analyze results. My skills include database fundamentals, many-to-many relationships, and window functions.
My own MySQL server
I host my own MySQL server for lab work, using practice databases to create tables, query related data, and produce reports. I completed SQL coursework on Udemy and applied the material in this environment.
Relational data and analysis
Practical query work with books, inventory, customers and orders, students and papers, TV reviews, and employee salaries.
Databases, tables & CRUD
Creating databases and tables; inserting, selecting, updating, and deleting records. Using primary keys, defaults, auto-incrementing IDs, and WHERE conditions.
Filtering & sorting
Selecting distinct values, sorting by one or more columns, limiting results, and matching text patterns with wildcards.
String functions
Combining and shortening text, replacing characters, changing case, trimming whitespace, and nesting functions to format query results.
Aggregates & grouping
Counting rows, finding minimum and maximum values, calculating totals and averages, and grouping results. Using simple subqueries to find rows matching a minimum or maximum.
Types, dates & times
Working with text, integer, decimal, and date/time types. Formatting dates, extracting date parts, calculating date differences, and using timestamp defaults.
Logic & conditional results
Combining conditions, checking ranges and lists, handling NULL values, and using CASE to create conditional labels in query results.
Constraints & table changes
Using UNIQUE and CHECK constraints, naming constraints, and changing existing tables by adding, removing, renaming, or modifying columns.
One-to-many relationships & joins
Linking tables with foreign keys; using cross, inner, left, and right joins. Combining joins with aggregates, handling missing values with IFNULL, and understanding cascading deletes.
Many-to-many relationships & reporting
Connecting TV series and reviewers through a reviews junction table, joining three tables, and summarizing ratings and reviewer activity. Saving queries as views, filtering groups with HAVING, adding totals with ROLLUP, and inspecting MySQL SQL modes.
Window functions
Keeping individual employee rows while calculating department averages, running totals, and salary rankings. Comparing ranking methods, dividing rows into buckets, and reading first and neighboring values within a window.
Summarizing a book table.
This query counts books by author surname and sorts the totals from highest to lowest. It brings together grouping, an aggregate function, an alias, and sorting.
SELECT author_lname, COUNT(*) AS books_written
FROM books
GROUP BY author_lname
ORDER BY books_written DESC;Comparing rows with window functions
I use window functions to compare each employee salary with its department average, rank salaries with ties, calculate running totals, and compare neighboring rows with LAG and LEAD.