Get startedGet started for free

Change types with ALTER COLUMN

The syntax for changing the data type of a column is straightforward. The following code changes the data type of the column_name column in table_name to varchar(10):

ALTER TABLE table_name
ALTER COLUMN column_name
TYPE varchar(10)

Now it's time to start adding constraints to your database.

This exercise is part of the course

Introduction to Relational Databases in SQL

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Select the university_shortname column
SELECT ___(___) 
FROM professors;
Edit and Run Code