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_name | record_type |
|---|---|
| John | Employee |
| Alice | Employee |
| Bob | Employee |
| Carol | Employee |
| David | Employee |
| Emma | Employee |
| Frank | Employee |
| Grace | Employee |
| Henry | Employee |
| Ivy | Employee |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Build the next SQL skill
WHERE Clause & Filtering
Practice SQL WHERE clauses with realistic boundary, NULL, text, date, exclusion, and production-filtering problems.
Basic SQL Functions
Practice production-oriented string cleanup, numeric transformations, NULL handling, tolerant conversion, and delimiter parsing.
ORDER BY & Sorting
Practice deterministic SQL ordering with tie-breakers, custom priorities, NULL placement, expressions, joined data, aggregates, and portable top-N patterns.
Open the interactive workspace and practice across SQL topics.