MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Relational Databases in SQL

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Select the university_shortname column
SELECT ___(___) 
FROM professors;
Edit dan Jalankan Kode