USECASE
The aim of this page 📝 is to explain how to learn SQL with Mode's tutorial using Kevin Li's approach with an exciting HN discussion I embarked on my journey to learn SQL using Mode's tutorial and discovered an effective learning strategy from Kevin Li. His approach emphasizes three key points:
- Quickly identify foundational knowledge.
- Build a personal curriculum to become an expert and avoid the trap of the expert beginner.
- Sprint hard for the first 15-20 hours to impress initial memory, then decelerate to a more regular pace.
To build my personal SQL curriculum, I'm using Mode's SQL Tutorial.
I've added an ID (MST) to track my progress, and I quickly create files with numbers and titles of lessons using web scraping with Beautiful Soup. This method allows me to organize my learning material efficiently and monitor my progress easily.
Python Code with Explainer
Initial Setup and HTML Parsing:
We start by importing necessary libraries and fetching the HTML content from Mode's SQL tutorial page.
import requests
from bs4 import BeautifulSoup
url = "https://mode.com/sql-tutorial"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
Extracting Titles:
Next, we find all <h4>
elements which contain the lesson titles.
titles = [title.get_text() for title in soup.find_all('h4')]
Creating Files with Formatted Titles:
Finally, we create files for each title, formatted with leading zeros and appropriate naming conventions.
for i, title in enumerate(titles):
file_name = title.strip().replace(' ', '-').replace('/', '_') + '.md' # Replace spaces with hyphens and add .md extension
file_name = f"{i:02d}-{file_name}" # Prepend index with leading zeros (2 digits)
open(file_name, 'a').close() # Open file in append mode to create or update access timestamp
This code ensures that:
- HTML content is fetched and parsed.
- Titles of the lessons are extracted.
- Files are created with formatted titles and indices.
Using this script, I quickly generate organized files in my file system and add content as I progress through the curriculum. This method aligns with Kevin Li's strategy, helping me track my progress and stay motivated in my learning journey.
LINKS
https://news.ycombinator.com/item?id=41909827
https://mode.com/sql-tutorial
Top comments (0)