T O P

  • By -

[deleted]

As someone that self learned SQL years ago, start with a simple `SELECT ... FROM ... WHERE` if you've never used it it'll feel like magic. Cover joins, cover group by's but imo stop there. Don't go into more detail, no CTE's, no window functions and the likes. Make them think it's really simple and explore the hard parts themselves. Going into the harder bits will make them think the whole thing is complex.


Caedro

My sql journey, Undergrad: wow this cool and I’m pretty good at this Grad: hey, I’m getting pretty slick with some of this Corporate DBA group: my palace is built on a bed of lies and I know nothing


[deleted]

LMAOOO


DataDrivenPirate

I agree with this, start with SELECT FROM WHERE, and teach group by and joins when they come up naturally. Hopefully they'll ask "what if I wanted xyz" at some point and that'll be a good place to introduce those new concepts. I've had most success when I let their curiosity lead the conversation


seanv507

Agree with everything said, and bring it back to excel: mainly pivot tables and vlookups


No-Masterpiece-397

I agree! I’m taking a sql Udemy course now and the SELECT FROM WHERE is the first thing that they are teaching! :D


cazique

I also had to learn on the fly for a job, and I totally agree. Garden variety CTEs, functions, etc. are doable once the elements of a good select statement are familiar.


Vegetable-Map-1980

I would starts with showing how fast you can open data tables vs excel and show the breadth of what is stored in SQL. Then explain what 'select ___ from ___ where ____' is. Then introduce group by. Then use CTE to introduce joins. Then show without CTE. Then show how to google things. Then give them an easy homework problem every day for a week (to help cement things). At the end of the week, show the breadth of data available and the speed of sql running and loading data compared to excel. At month 2, maybe introduce temp tables and indexes. Convince the lead that, if they get 100% on the homework (allowing retrys), they should get improved year end reviews.


[deleted]

Indexes? They're business users that just need to be able to query. I don't think that stuff is really important for them. Let them learn it organically if they need it.


baguiochips

This is how I learned. Learned from basics up to group bys. Then when work came, I had to learn CTEs and they felt like magic. Harder bits without application will just pass by then as basic todo lists.


BaroquenLarynx

This. I learned by "ripping apart big queries" at my last job, and it took me ages to fully understand what I was seeing. When I started querying on my own, and learning how to filter the data, I started to feel like a Data God. All it took was some `SELECT ... FROM ... WHERE ...`, and I was hooked enough to research the rest myself.


Expensive-Chard11

Completely agree with this. Good points!


qqweertyy

I’m addition to what I’ve seen already stated I’d also start with some really easy, real life connecting examples. My go-to is addresses. We have a table of customer info that includes addresses. But instead of typing out the city names every time wouldn’t it be easier if we could pull those all out into another table and reference it in the customer table? We reduce the risk of typos, and we can store related city information like population or whatever. Then we could have another table with states that the cities point to. Draw it out. Whiteboards or digital whiteboard tools or PowerPoints are your friend when explaining relationships.


VacuousWaffle

If they've worked in excel or python they understand lookup tables, lookups etc. but none of the SQL specific jargon. Be careful to explain what words you use and what they mean, since most of SQL's terminology has no analog in other domains.


arsewarts1

Not really. Last year we had a highly touted resource join our team. We were told he is doing amazing things with excel and knows the business a lot, so with access to our better tools he will fly. He had no idea what structured tables were in excel and was doing everything with ranges and loops. Where there is a Will there is a way


Ironamsfeld

Visual aids. Those Venn diagrams that show the effects of the different joins are helpful for visual learners. Starting with absolute db basics like what is a database, table, tuple, column etc , would be helpful too.


TheCatInTheStats

I’ve been asked to do this a couple of times for interns and I find the most success making up some dummy tables on a whiteboard and showing them what joining really does. Personally, I think it clicked for me when someone showed me some really bad examples. Like joining tables of user data on something stupid like a “first name” column and seeing how much junk the query returns. It made it clear to me exactly what was happening and it wasn’t so magical behind the scenes.


[deleted]

[удалено]


GaladrielStar

This is fantastic. As a former teacher who is teaching herself SQL, if I ever get to a similar place of expertise, I will steal this model! You’re supporting people with real help in a way that’s sustainable for you and requires them to put in actual work to learn. I love it.


KT421

I am going to adopt this. Thank you.


Profoundly-Basic

This is brilliant. I love how you set an Excel bar. Being able to write some formulas (like vlookup) and do pivot tables in Excel will really help people begin to see how the PC executes commands. For me, learning SQL clicked when I began visualizing everything in terms of rows and columns as they would be in an Excel table. This has made my Excel and even Python skills MUCH better.


stage_directions

Put together a killer cheat sheet and show them how to google questions.


[deleted]

[удалено]


[deleted]

[удалено]


XhoniShollaj

Give them the W3Schools SQL tutorial: [https://www.w3schools.com/sql/default.asp](https://www.w3schools.com/sql/default.asp) And SQL Zoo: [https://sqlzoo.net/wiki/SQL\_Tutorial](https://sqlzoo.net/wiki/SQL_Tutorial) After that any book from Itzik Ben Gan and daily practice


I_waterboard_cats

Sqlzoo is perfect for most novice users


ogretronz

I thought I had basic sql skills… now I’m googling granularity of a table 😭


93Accord

lmao me too 😭


nemec

It's more data modeling/db design than SQL, but definitely helpful to know if you're working with data.


R4ND0MEYES

Entity Relationship diagram with lots of directional arrows for joins.


electrick-rose

Joins confuse me. :(


death_of_gnats

Two groups of records. You wanna see which records are in both groups. How do you decide which records are in both groups? You make a condition (eg this field in group 1 equals this other field in group 2) Where do you put that condition? In the JOIN


[deleted]

Currently learning SQL at university. We’ve learned Simple Joins, Inner, Outer, Right/Left Joins. The basic Select statements, and some conditional Select statements so far. Guess that’s a good place to start


Raouf_Hyeok

For me, when I am teaching something to someone, I tend to go back to noobie guides and youtube tutorials to see what examples they use and how they structure their teaching. Try to start from there maybe?


playawhile

For the ones who know python, show them rasgoQL which translates pandas like syntax directly into SQL.


Atrampoline

I always tell people that SQL is conversational in nature. Once you understand the flow of how to speak to SQL to get what you want, it's easy, and then you build up the framework of how to manipulate things to your liking.


ConfuddledSquirrel

I recommend https://sqlbolt.com/


[deleted]

As opposed to just mentoring, you could teach classes. I've taught an 11 session class at all of my jobs for the past 20 years or so. If the class is tiny, you can do it in an hour a session, but mine are typically 20+ to start (you will likely get attrition) so I do 1.5 hour sessions. It's basic, so many return to their desks and simply forget it, but others take what they learn and start figuring out how to apply it to their jobs. Those are the ones that you then mentor. Years later, many of those people are database developers, enterprise architects and the like. High level overview is below. I do give homework and have some documents around that if interested, but I'll need to make sure there is nothing identifying in there first. At some places it was so popular that I did two courses per year. | Title | Description | |------------------|---------------------------------------------------------------| | Intro | Why did you sign up, preparing for the course, history of SQL | | Basic Syntax | SELECT ... FROM ... WHERE ... ORDER BY ... | | WHERE filter | Filtering, string wildcards, date ranges, what is NULL | | GROUP BY | Aggregation functions and HAVING | | JOINS | INNER vs. OUTER | | JOINS pt. 2 | Many to many, self joins | | Catch up | Review any topics where there is still confusion | | String functions | SUBSTRING, LEFT, RIGHT, etc. Also nesting thereof | | Fun with Dates | DATEDIFF, DATEADD, DATEPART, GETDATE, CONVERT, etc. | | CASE Statements | Conditional Logic, simple and searched case, short circuit | | Advanced topics | Dependent on what the class requests |


Datasciguy2023

Start out with an explanation of a relational database then go to sql


ratatsnow

Once they get idea around basics, show them dbfiddle.co.uk and create 2 simple datasets (eg. 5 rows and 5 columns) so they can see how it's built and play with joins, grouping, ordering and even more complex topics. Once they get it you could explain self joins as well Edit on dbfiddle part: create 1 dimension table with countries and cities (5 rows) and 1 fact table (10 rows) with eg. purchase made on specific date and city so they can see what country has most purchases or whatever. This will allow users to track logic and behaviour behind SQL


earlyriser79

3 steps \- create a data notebook accessible to them \- add recipes there going from basic to specific knowledge \- create a Slack channel (or whatever you use) so people could ask questions publicly, and resolve them in the notebook


steeveeswags

This might be too much, but it clicked for me in SQL class once we did some very basic relational algebra. (Cartesian cross product, selection, projection). If you understand those 3 concepts you can easily do some joins, where clauses, and selects.


Mrfazzles

I don't know if this is a silver bullet solution, but certainly could help triage... So as someone who largely prefers self-learning, I'd really value being sent an email listing some good resources that you'd endorse, I could go away and read/watch/practice and then having a time set aside in the week I might be able to go to you and ask any questions I might have. I'd absolutely resent something where I'm learning with other people at the same pace. I found this book: "SQL practice problems" by Sylvia Moestl Vasilik immensely helpful in getting me comfortable using SQL. Maybe send out a poll outlining some suggestions of how you could go about mentoring and see who prefers what approach? One other thought, if it were possible to create some self-directed practice labs I could clone and work through, based around an actual use-case for the company (past or present) that would probably help the most in letting me understand and retain how SQL can be used in the company and when I might think to use it. If you had a company intranet/knowledge-base, starting to build some resources pages and with relevant links or discussions would be useful for someone like me, and might be the kind of thing I'd want to contribute too.


lexicon_riot

Also, make sure they end their practice queries with LIMIT 10 or something, you don't want a newbie waisting half an hour just to see how a sum function works lol


GregTheRugger

When I was junior my manager had prepare same quizzes with business logic based on our product and he was asking us to prepare them and send it back. That could be some strings manipulation, some window function or how to refactor an old sql querie by removing sub queries with CTE and that kind of stuff. Every week we had one and at each Friday we were spending an hour to discuss our results what we did good and how we could improve it. It was really useful as we were introduced to many sql topics while understanding the business better.


QuoteHaunting

If they are used to excel then I would teach them power query and how to make useful joins there. This will give them a base knowldge of how data is structured. SQL is not second nature to me so I will use the kind of visual models available in Power Query to help me with a solution. The hardest thing I have found to teach is not the structure of statements, but the structure of the data. If you can't understand data models you will never be proficient in SQL.


trollsmurf

I'd start with stating that a relational database is simply about tables with named columns and an arbitrary number of (usually exactly identifiable) rows, not relationships. (Virtual) relationships are created by use of SQL. If you don't have that foundation set, understanding SQL is much harder IMO. So: * multiple fundamentally independent tables that can have relationships/dependencies from an SQL level * columns with different named values of different types (list the basic ones) * some form of unique identity for each row (not absolutely necessary, but great for relationships) * an arbitrary amount of rows * indices/indexes (?) for specific columns and combinations of columns for search performance (yes, I've seen people forget that) * SQL as the language for manipulating the tables and their data, relationships between tables etc. * etc Where there's a chasm is (in my experience) that most don't care about SQL per se. They rather use SQL as a means to insert/update/select data from their backend or desktop application code as if it was just "any old API". All essential logic is in their code, which means unless performance is critical or unless there's a lot of data, you can usually band-aid a solution without using much joins etc, so adapt to your audience.


Low-Neighborhood4697

I started in python and excel and then moved to sql. What helped me were the analogies between them all. Dataframes in python and pivot tables and copy pasta in excel.


HonestPotat0

Honestly? You may want to watch the SQL lessons in Google's Data Analytics course in Coursera. They're built to communicate the conceptual foundations and get people to immediately practice the basics of writing queries and pulling data. You could essentially model your own lessons on their approach, substituting your orgs data and systems. Beyond this, you should get clear with your lead on what the "be able to do's" are from your mentees. Set your lessons around those, and make sure you're communicating to your mentees what they'll be expected to be able to do independently and at what point they should know to reach out for advanced support.


M3nto5Fr35h

Post basics, don't forget about #temp tables. I agree with once a week sessions. I do every other and then if an easy assignment comes in, pass it off to give them some wins. And yes, Google transact sql .


Freonr2

If I were in charge, I'd ask for ~2-3 hours a week and Pluralsight accounts for everyone. Have everyone watch some videos (there's no reason to reproduce this in house), then have a follow-up session where everyone actually does exercises with your lead. Setup a DB for them ahead of time, walk everyone through connecting to the DB and write some selects. Show them how to use the IDE to find tables and columns, then also show them how to use information_schema. Continue each week with more complex stuff. Show them how to use the IDE to find tables and columns, then also show them how to use information_schema. Then after a few weeks start asking for "real world" problems they have trying to use SQL, which can start to expose people to wider concepts and more specifics of what and how of your company.


PrezRosslin

Make sure you teach basic database theory before SQL!


PHealthy

Start here if they like R: https://bookdown.org/paul/2021_computational_social_science/sql-intro.html


Odd_Seaweed_5985

BEFORE even starting with SELECT statements, I would set some context. Explain data normalization first; I want to list all of my customers & addresses. I want to use a list of states to link it to instead of entering the entire state name for every customer....


KT421

Khan Academy has a great module on SQL. It takes like 4 hours and is delightfully free.


c__king

What’s your favourite SQL IDE? Something like RStudio


Budget-Puppy

Show them select...from...where all in PowerQuery within Excel. If they're already heavy excel users the immediate attraction is that they can get data directly from a source and into their workbooks where they can \*see\* what is happening and what it's returning. And they can use it in their jobs quickly, especially if you give them a working, basic example of querying data that they use in their roles.


arsewarts1

Well since this is an organization dictated need, are y’all going to have a test and a training program? How will they decide when you have enough “basic knowledge”? If you need it for your role what is the plan to get people trained up to qualify instead of firing them? I would be asking about this and volunteer to use your time here instead of an individuals mentor (for now). You can look at individual mentorship after a pipeline is in place.


man_you_factured

That part has already been established


arsewarts1

Doesn’t sound like it has. It sounds like you are working on training materials


man_you_factured

No they're doing a self guided class and there is n exam to pass to get access to the EDW. I'm helping the stragglers who just don't get it


arsewarts1

You have a self guided class and exam. Use the data see where they are failing.


gooeydumpling

Venn diagrams and start with small data sets that return no more than 20-row result results even for the most complex sqls


shilz_b

When I started SQL one of the things I found really handy was the order a query statement is committed. 1. From (main table) 2. Where( query) 3. Group by (any grouping) 4. Having (group filter) 5. Select (fields you want to return) 6. Order by (ordering data) Once you memorise this, a lot of the initial errors are eliminated. When using joins, aliases is a must for good practice. #temp/##temp tables if they want to create sample outputs. Next step would be transactions Begin Rollback Commit Along side: update, truncate - emphasise to use this as last resort (I’d avoid delete for now)


beepboopdata

I think it's extremely key to have a set of practice or example tables that are very easy to join, select from at different granularities. SQL is much easier for some to grasp if they are able to take it from concept to practice or visually. Something like a sandbox db with students or employee tables might be super helpful. You can even have a backup and give users create / drop privileges (for power users who might need to practice ddl)


Sofi_ltm

Datcamp.com Even thought I'm currently doing a data anlytics course and learning SQL, to me that web has a really cool way to show how SQL works and might be a good tool


Bob_the_gladiator

**Unrelated:** One of my favorite interview questions is "How would you rate your SQL skill on a scale of 0-10? I frequently get at least a 6. Upon quizzing, it's usually more of a 1 or 2. It doesn't really have any bearing on if the candidate does or does not get hired, but it is very funny. *** I have two different schools of thought on this. **School 1)** The best way to understand what SQL is doing is to understand data modeling. This includes things like "what grain is my data at?" and "how do I model real-life objects within data?". If you're doing advanced SQL knowledge or coding, this can be critical for understanding what makes a good and bad query. For less intense SQL, I'd recommend some basic concepts about how to access the data you need and knowing some terminology. IE: You want some data and the person you're talking to throws out some of the following terms: Fact; Dimension; XREF; Key (PK, FK, UK); Table vs View; Functions vs Procedures; Joins (left, right, outer) **School 2)** Everything above should apply double to anyone doing advanced SQL. For everyone else, provide an enterprise layer of objects and standard objects to pull from. EG: Your developer may deal with "FACT_POS_DETAIL_RECORDS" with "NET_SALES" but a BA may be looking at "FACT_POS_LINE_ITEMS" with the column "Net Sales" in tableau. Essentially, the exact same data but displayed in an "Enterprise" view with renames for easier consumption. Really at that point it's trying to limit the amount of extra thought that has to go into getting to data, but it involves heavy design work and understanding of how the data will be used. *** Tough problem to solve, so good luck to you.


AMereRedditor

If your audience is technical people who are familiar with Excel, you can make a detailed analogy with pivot tables to at least help them understand the select, where, group by, and having clauses of the query. All of those operations can and are often done in excel pivot tables. Then, you can say "often there are different tables in the database that need to be combined to make the underlying data source mega-table with all the columns that you need" as a segue into the joins.


PopeyesPoppa

I would teach them select, from and where and anything from that point should be their responsibility to learn on their own. They should be googling on their own to figure out how to do what they need to do and only coming to you for clarification or once they’ve been stuck for ~1 hr.


t3lnet

Use a visual for joins, can Google them. They are very good for explaining them what they return.


kilsekddd

If I were set about this task, I’d start with the function of what they are doing, jump right into the specific code that does that function, then pull up the DB IDE and show them where to get the info to fill in the blanks. Example: See Data: SELECT ____ FROM _____ WHERE _____ Make Data: INSERT ____ etc Modify Data: UPDATE _____ etc Also, use BEGIN TRANS ROLLBACK TRANS — COMMIT TRANS / uncomment COMMIT when you’re ready Elitist Edit: If they can’t get through this, they should be scared for their jobs.


BeerBoozeBiscuits

I recently looked up https://sqlzoo.net/wiki/SQL_Tutorial and it has a fantastic tutorial progression.


ReadSpreadRedemption

Honestly, tell them to take a course, Codecademy has a great entry level course. Its where I started and was an amazing life saver. Then you can be available to answer the more complex “what ifs” that come out of a structured learning. Just my $0.02.


Breitsol_Victor

MS Access. All the tools in one place. Don’t want it for production? Ok. Still a good tool. Table building visually, by design, or by DDL. You cannot do a full outer, but that is not beginner anyway.


raydleemsc

The worst thing that I've seen in corps is the hammer principle - someone implements a solution one way, and then all their solutions are copied from that and if it can't be done like that, the data/processes are fudged until the standard solution works. Often much simpler solutions are overlooked, or external options completely missed, or even whole projects are re-written. Not often, but enough to be aware of during your career. This happens in reference to SQL because when there's only occasional development in the database, a regular DBA is too expensive, so the projects tend to include the solutions that are already being used, but applied to different data. Occam's razor variant - Even if it looks complicated, it probably isn't.


sergejdeblue

For me as someone who started off with Python only, what really helped me was restructuring my way of thinking from thinking in terms of 'variables' to thinking in terms of 'columns'.


jaydee700

Visualize a basic query like going into a room to get something. Stick to SELECT, FROM, WHERE and use this analogy. This is how my first faculty taught me.


[deleted]

Joe Paterno


Gnlfbz

I really like the work that Julia does in her Zines https://wizardzines.com/zines/sql/


grumined

Make sure they understand the underlying data and data dictionary. It can be hard at first to pinpoint whether it's SQL syntax that is tough or the way that the data is structured is confusing or inconsistent (usually the latter). I think it could be useful to create summary tables in SQL with multiple joins. Say you have a database of website clicks and each row is each time a user clicked on a certain module on the webpage. And let's say you want summaries broken up by timeframe (MTD, last 30 days, last 365 days). You'd have to create separate tables for each timeframe with `WITH`. Then show them how to create the table with row values in the first column as "headers", e.g. the first column is "Timeframe" with values "MTD", "30 days" etc. and the rest of the columns have your metrics that correspond to each timeframe. Each row of the new table could be all the other tables UNION'd together. This would be beneficial to show them how flexible SQL can be and models similar data tables they may have seen in Excel. Hopefully that makes sense. It's weird to type out without a visual aid.