DigiSkill — Free SQL Training https://www.digiskill.live/training/sql/ DigiSkill has two SQL practice activities and a focused browser checker: SELECT name, score FROM students, numeric WHERE comparisons, ORDER BY score ASC/DESC and LIMIT. Lessons build toward those two activities. No live database, JOIN, GROUP BY or writes are included. 1. Choose columns with SELECT Separate the columns you want from the table you read. Understand the idea A table contains rows and named columns. SELECT describes the columns to return, while FROM identifies the source table. Choosing the needed columns makes the result easier to understand than returning everything without a reason. SQL is a language for working with data; this training uses a limited read-only practice subset. Work through it Read the table name and column names before writing a query. List the requested columns in the requested order, separated by commas. This first step selects columns; the following lesson adds a row filter. The linked practice activity combines both steps. Worked example SELECT name, score FROM students; The query returns the name and score columns. It does not filter by score yet. The practice task asks for a specific score condition, so this query alone is only a starting point. Common mistakes: - Confusing a table name with a column name. - Forgetting the comma between selected columns. - Assuming selecting columns also filters rows. Practice: https://www.digiskill.live/practice/sql-filter-scores/ Reference: https://www.postgresql.org/docs/current/queries-select-lists.html — 2. Filter records with WHERE Translate a boundary condition into a comparison. Understand the idea WHERE filters rows according to a condition. A comparison such as score >= 75 keeps scores at or above the boundary. A query can choose only certain columns while also keeping only certain rows: these are separate decisions. Real SQL has many more expressions than the DigiSkill checker supports. Work through it Translate the question into a condition, then test a value below, at and above the boundary. The DigiSkill filtering task asks you to keep the displayed source order, so do not add a sort for that task. Real databases do not promise a particular result order without an explicit ORDER BY. Worked example SELECT name, score FROM students WHERE score >= 75; Boundary checks: 74 excluded; 75 included; 76 included. The comparison includes equality. This matters when the brief says “at least”. The browser exercise checks additional score datasets so hardcoded rows do not satisfy the task. Common mistakes: - Using > when 75 must be included. - Returning only today’s matching names by hand. - Assuming source order is guaranteed in every real database. Practice: https://www.digiskill.live/practice/sql-filter-scores/ Reference: https://www.postgresql.org/docs/current/queries-select-lists.html — 3. Control order with ORDER BY Choose ascending or descending order deliberately. Understand the idea A result set does not have a dependable default order in a real database. ORDER BY specifies a sort. ASC puts smaller scores first, while DESC puts larger scores first. The best direction depends on the question, such as highest scores versus lowest prices. Work through it Choose the sort column and direction before limiting rows. Check a small set manually. When values tie, a real query may need an additional tie-breaker for a fully predictable order. DigiSkill’s top-three exercise states that its test scores do not tie and supports one score sort. Worked example SELECT name, score FROM students ORDER BY score DESC; Scores 61, 95, 80 become 95, 80, 61. Descending order puts the highest score first. This query orders all rows; the next lesson keeps only the requested number of top rows. Common mistakes: - Using ASC for a highest-first task. - Relying on the order records happen to appear in. - Ignoring ties when a real result needs a unique order. Practice: https://www.digiskill.live/practice/sql-top-three/ Reference: https://www.postgresql.org/docs/current/queries-order.html — 4. Take the top results with LIMIT Sort the intended result before selecting a small subset. Understand the idea LIMIT restricts the number of returned rows. A limit by itself does not mean highest, newest or best: it just takes rows from the result order. To request top scores, specify the relevant descending order and then limit how many rows are returned. Work through it Build the query in small steps: select the columns, identify the table, apply a filter if needed, set the sort and set the limit. Re-read the requested row count and check whether ties require a rule. The exercise uses exactly three rows and a no-ties test dataset. Worked example SELECT name, score FROM students ORDER BY score DESC LIMIT 3; The query sorts scores from largest to smallest and returns three rows. In this practice table, this produces the requested top three. Database dialects can differ, so check the documentation for the system you use. Common mistakes: - Using LIMIT without the necessary sort. - Keeping four rows when three are requested. - Assuming every database supports identical syntax. Practice: https://www.digiskill.live/practice/sql-top-three/ Reference: https://www.postgresql.org/docs/current/queries-limit.html —