CodeBlanks Logo Icon CodeBlanks

Summary - SELECT basics

Combine column selection, aliases and literals to write a query.

Summary - SELECT basics

In this group you learned the SELECT basics:

  • SELECT names columns, FROM names the table
  • * picks all columns; otherwise list them by name
  • AS gives columns a result name
  • Literals and calculations are allowed

Now you will combine these in one query.

Practice Summary - SELECT basics

Select the name column and twice the price aliased as dbl from products.

Starter code

query.sql
-- write your query
SELECT
FROM

Sample solution

query.sql
SELECT name, price * 2 AS cift
FROM products

Expected output

name   cift
Kalem  10
Defter 24

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which is a valid SELECT query?

  • FROM customers SELECT name;
  • SELECT name FROM customers; Correct answer
  • SELECT name customers;
  • customers SELECT name;

Explanation: SELECT comes before FROM.

2 Summary - SELECT basics: match the terms

Term Meaning
SELECT choose columns
FROM specify table
AS give alias
* all columns

All lessons in Beginner