Technical skill practice

SQL RENAME COLUMN: Preserve Data While Updating Its Name

Renaming a column changes how the schema addresses that field. It does not convert the stored values into a different business concept. Check application references and dependent objects when changing a real schema.

The practice task

Rename dept to department in a fictional team directory, then read the same stored value using its new name. The example keeps the data change separate from the naming change.

The data below is fictional. Run the example in a new SQLite database. It was checked with SQLite 3.51.0; other databases may use different syntax, functions or type rules.

Complete worked query

Create the small fixture and run the query together. The IDs, boundary values and missing entries make the result small enough to check by hand.

CREATE TABLE team(id INTEGER, dept TEXT);
INSERT INTO team VALUES (1,'Design'),(2,'Support');
ALTER TABLE team RENAME COLUMN dept TO department;

SELECT id, department FROM team ORDER BY id;

Checked result

This is the result of the exact example above. NULL marks a missing database value rather than the text string "NULL".

Result rows

id | department

1 | Design

2 | Support

Read the result

Both department values remain readable after the rename. The query uses department, matching the new schema name. Nothing in this operation maps Design to a different category or rewrites the business meaning of Support.

Application SQL that still refers to dept needs attention. The database may update some internal dependencies according to its own rules, but that does not edit a query string stored in an application repository or an external report.

A clear name can improve comprehension, yet it can still be an incompatible change for a consumer. Review deployment order when the old and new application versions might run at the same time. The toy exercise demonstrates the field rename, not a complete production migration plan.

Mistakes to check

Use these checks when adapting the example to a different dataset.

  • Distinguish a schema rename from a value transformation.
  • Search external queries and positional data mappings.
  • Check the database version and its dependency-update rules.

Questions, answered

Can I run this example as written?

Yes, in a new SQLite database using the schema and values shown. The result above was checked with SQLite 3.51.0. Keep it separate from an existing database.

Can a result alias provide a new label without renaming the column?

Yes. SELECT dept AS department changes the output label for that query while retaining the underlying field name. Use a result alias when the need is presentation rather than a schema change.

Sources and examples

ResumizeAI team. Examples are fictional teaching material, not customer results. Replace sample details with your own facts.

Your experience. A complete resume.

Build in Resumize with ATS-friendly templates, guided editing and a live preview. Start free, then upgrade when you need more.

Free account required. Free-plan PDF exports include a watermark.