SELECT Statements SQL Topic exerciseEasyVerified answerSQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

Add a Constant Literal Column

Return first_name with a constant record_type value of Employee.

Exercise brief

Understand the request

Integration analyst A combined export needs a source-type marker on every employee row.

Return first_name and an extra column called record_type whose value is the literal text "Employee" for every row.

Return

  • Return first_name and record_type.

Constraints

  • Project Employee as a text literal and alias it record_type.

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

employees

  • first_nameVARCHAR(50)

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

A SELECT list item can be any expression, including a literal value like a string, number, or NULL.

Hint 2

Wrap text literals in single quotes: 'Employee'. Add an alias so the column has a friendly name.

Hint 3

Add a quoted text literal beside first_name and alias the literal as record_type.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT first_name, 'Employee' AS record_type FROM employees;

Why this works

Constant columns are useful when you UNION two SELECTs and need a column that tells you which source each row came from (e.g. one query has `'Employee' AS record_type`, the other has `'Contractor' AS record_type`). They cost almost nothing at runtime.

Success check

Every employee appears once and record_type contains the literal 'Employee' on every row.

Expected result

Use this output to verify values, aliases, ordering, and row count.

first_namerecord_type
JohnEmployee
AliceEmployee
BobEmployee
CarolEmployee
DavidEmployee
EmmaEmployee
FrankEmployee
GraceEmployee
HenryEmployee
IvyEmployee

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Practice Online

Open the interactive workspace and practice across SQL topics.