Learn Without Walls
← Back to SQL Labs
← First Lab Lab 1 of 10 — SELECT & FROM Next Lab →

Lab 01 — SELECT & FROM

Ask your first question of a database. Learn to choose columns, rename them, and compute new ones.

⏳ Loading SQL engine...
📋 AVAILABLE TABLE: studentscolumns: id, name, major, gpa, year, scholarship, city, age id name major gpa year scholarship city age 1 Alice Chen Computer Science 3.8 3 1 Los Angeles 21 2 Bob Smith Mathematics 3.2 2 0 San Francisco 20 3 Carol Wu Computer Science 3.9 4 1 Los Angeles 22 ...10 rows total

📖 Concept Recap: SELECT & FROM

👀 Worked Example (read-only)

Study these queries before writing your own.

-- Get everything from the table
SELECT * FROM students;

-- Select specific columns only
SELECT name, major, gpa FROM students;

-- Computed column with an alias
SELECT name, gpa, gpa * 4 AS scaled_score FROM students;
✏ Guided

Exercise 1 — Your First SELECT

Show the name and city of all students. Replace each ___ with the correct column name.

💡 Hint: You need two column names separated by a comma. Check the schema box above for exact column names.
💪 Independent

Exercise 2 — Multiple Columns with an Alias

Show name, major, year, and scholarship for all students. Rename the scholarship column as on_scholarship using AS.

💡 Hint: SELECT col1, col2, col3, col4 AS new_name FROM table;
🔥 Challenge

Exercise 3 — Computed Column

Calculate a weighted_score = gpa * year. Show name, gpa, year, and weighted_score. Students who stay longer and maintain high GPA score highest.

💡 Hint: Multiply two column names and give the result an alias: gpa * year AS weighted_score
🏆 Mini Project

Mini Project — Understanding the Student Population

You are a new academic advisor. Write 3 different SELECT queries to get to know the students table. Run each one individually by selecting and running, or run all at once.

  1. The full roster — every column, every row.
  2. Key identifiers only — name, major, and year.
  3. An interesting calculated field (e.g., gpa / 4.0 * 100 AS gpa_percent or age - 18 AS years_since_hs).

🏁 Lab 01 Complete!

You can now write SELECT queries to retrieve any combination of columns from a table, create aliases, and compute new columns on the fly.

Ready for the next challenge?

Continue to Lab 02 — WHERE →