DataBolt

All Lessons

Introduction to SQL
SQL Lesson 1: Your Sample Database
SQL Lesson 2: SELECT — Reading data
SQL Lesson 3: WHERE — Filtering rows
SQL Lesson 4: AND, OR, NOT
SQL Lesson 5: BETWEEN, IN, LIKE
SQL Lesson 6: NULL — The Mystery Value
SQL Lesson 7: ORDER BY
SQL Lesson 8: LIMIT & OFFSET
SQL Lesson 9: Aggregate Functions
SQL Lesson 10: GROUP BY
SQL Lesson 11: HAVING
SQL Lesson 12: INNER JOINs
SQL Lesson 13: LEFT JOINs
SQL Lesson 14: RIGHT JOINs
SQL Lesson 15: SELF JOINs
SQL Lesson 16: UNION JOINs
SQL Lesson 17: Joining Multiple Tables
SQL Lesson 18: Subqueries
SQL Lesson 19: CTEs (WITH)
SQL Lesson 20: CASE Statements
SQL Lesson 21: Window Functions
SQL Lesson 22: String Functions
SQL Lesson 23: Date & Time Functions
SQL Lesson 24: INSERT, UPDATE, DELETE
SQL Lesson 25: CREATE TABLE & DDL
SQL Lesson 26: Indexes & Performance
SQL Lesson 27: Transactions & ACID
SQL Lesson 28: SQL Execution Order
SQL Lesson 29: 50 Practice Problems

CHAPTER 3

SELECT Query

Reading data — every SQL journey starts here.

IN THIS CHAPTER

  • Reading specific columns with SELECT
  • Using * to select all columns
  • Renaming columns with AS aliases
  • Doing calculations in SELECT
  • Removing duplicate rows with DISTINCT

3.1 - Select Specific Columns

You almost never want every column. Pick what you need.

SQL

SELECT name, salary 
FROM employees;

3.2 - Column Aliases with AS

SQL

SELECT name AS 'Employee',
        salary AS 'Monthly Salary',
        salary * 12 AS 'Annual CTC'
FROM employees;

Exercise 👇

Exercise:

Tasks

1.👉Find all employee names
2.Find all departments
3.Find name and department
4.Find name and salary
5.Show all data
Stuck? Read this task's