Video summary

Learn Basic SQL in 15 Minutes | Business Intelligence For Beginners | SQL Tutorial For Beginners 1/3

Main summary

Key takeaways

Educational

Main Ideas / Lessons

  • SQL is essential for BI work even with modern BI tools

    • BI tools can generate SQL automatically for simple chart/report queries (drag-and-drop interfaces).
    • But you often must write SQL yourself to:
      • pre-aggregate
      • filter
      • select only the data needed
      • typically via views
    • Views improve performance by reducing large tables (e.g., millions of rows) to smaller, query-ready datasets (e.g., thousands of rows).
  • This tutorial teaches core SQL query concepts quickly (15 minutes)

    • Focus is on SELECT queries (retrieving data), not creating/deleting databases or tables.
  • Hands-on setup

    • Uses an SQLite database containing EA Sports FIFA football statistics.
    • Uses Navicat as the SQL client to connect/query the database (Navicat premium mentioned).

Methodology / Instruction-Style Content (Detailed)

1) Basic Querying with SELECT

  • Return the entire table: sql SELECT * FROM player;

  • Return only specific columns: sql SELECT player_name, birthday FROM player;

  • SQL is case-insensitive for keywords (lowercase or uppercase both work), but you can beautify for readability (e.g., SELECT, FROM in uppercase).


2) Renaming Output Columns with Aliases

  • Simple alias: sql SELECT player_name AS name FROM player;

  • Alias containing spaces (use quotes): sql SELECT player_name AS 'Full name' FROM player;


3) Filtering Rows with WHERE (and Key Operators)

  • Equality (numeric)

    • Example concept: return players with weight exactly 190.
  • Comparison (numeric)

    • Example concept: weight >= 190.
  • Multiple conditions

    • AND: both conditions must be true
      • Example concept: weight > 190 AND height > 190
    • OR: either condition can be true
      • Example concept is described similarly.
  • Text matching

    • Exact match: sql player_name = 'Aaron Galindo'

    • Alternative exact matching using LIKE (described as achieving the same goal).

  • Pattern matching with LIKE

    • Starts with text: % at the end
      • 'Aaron%' → “Aaron…”
    • Ends with text: % at the beginning
      • '%Aaron' → “…Aaron”
    • Contains text: % on both sides
      • '%Aaron%' → “…Aaron…”
    • Single-character wildcard:
      • _ represents one character
      • Example: T_M% means:
        • starts with T, then one character, then M, then anything after
  • IN operator for text (exact matches only)

    • Replaces multiple OR checks for exact values
    • Does not support % / _ patterns
    • Example concept: sql WHERE player_name IN ('Cristiano Ronaldo', 'Lionel Messi')
  • BETWEEN for numeric ranges

    • Example concept: sql WHERE weight BETWEEN 180 AND 190
  • NULL handling

    • Use IS NULL / IS NOT NULL
    • Example concept:
      • select from match where home_player_1 IS NULL (or IS NOT NULL)

4) Sorting Results with ORDER BY

  • Ascending (default): sql ORDER BY weight

  • Descending: sql ORDER BY weight DESC

  • Sorting matters less in this workflow because BI tools can sort after data retrieval.


5) Joining Data from Multiple Tables (JOIN)

  • Motivation:

    • Some tables (e.g., “player attributes”) include player_id but not the player name.
    • To create a view with both name and rating, you need to combine tables.
  • Approach shown:

    1. Select fields using table_name.field_name notation
      • e.g., player_attributes.player_api_id, plus player_attributes.date, plus rating
    2. Attempting player.player_name without joining causes an error.
    3. Use an INNER JOIN: sql INNER JOIN player ON player_attributes.player_api_id = player.player_api_id

    4. Result: player names appear alongside attributes.

  • Table aliases to simplify queries:

    • Alias tables as single letters:
      • player_attributes AS A
      • player AS B
    • Then reference fields like:
      • A.player_api_id, B.player_name, etc.
    • This makes queries cleaner.

6) Aggregation with SUM/AVG and Grouping with GROUP BY

  • Goal:

    • Combine multiple rows per player (e.g., different dates) into a single result per player.
  • Using an aggregate function:

    • Example concept:
      • SUM(A.overall_rating) to total ratings over time (an attempt is shown)
  • Why SUM alone didn’t work:

    • You must define grouping.
  • Use GROUP BY:

    • Include all non-aggregated fields in GROUP BY.
    • The tutorial refines grouping by removing date from grouping so ratings across all dates combine per player.
  • Output alias and ordering:

    • Create a result alias, e.g. AS rating
    • Sort descending aggregated rating:
      • ORDER BY rating DESC
  • Sanity check / interpretation improvement:

    • Ronaldo and Messi not appearing as expected after SUM.
    • Possible reason: different counts of available records.
    • Adds ideas:
      • mentions checking with COUNT
      • switches to average for better comparison:
        • replace SUM with AVG: sql AVG(overall_rating)

7) Filtering Aggregated Results with HAVING

  • Key distinction:

    • WHERE filters rows before grouping.
    • HAVING filters grouped results after GROUP BY.
  • Structure:

    • Put HAVING after GROUP BY and before ORDER BY.
    • Example concept: sql HAVING score > 85
  • Result:

    • Reduces the output set (only 26 records mentioned).

8) Final Formatting Takeaway

  • Encourage readable SQL formatting:
    • Use uppercase for SQL keywords.
    • Keep clean structure and layout.
  • Conclusion:
    • This is a small foundation, but enough to confidently learn more.

Speakers / Sources Featured

  • Speaker: Adam Finer (explicitly stated near the end: “This has been Adam Finer…”)
  • Source/channel: “Vitamin BI” (channel name mentioned: “Hello and welcome to Vitamin BI…”)
  • Tools mentioned (not speakers): Navicat, SQLite database (football/FIFA dataset)

Original video