Get the App
SLTechnology News&Howtos  ›  Database  › 

SQL add columns, modify columns, delete columns

Shulou Source: shulou.com Published: 2022-06-01 06:23:56 09月29日 Update

SQL statement to add columns, modify columns, delete columns

1. Add columns:

Alter table tableName add columnName varchar (30)

2.1. Modify the column type:

Alter table tableName alter column columnName varchar (4000)

2.2. Change the name of the column:

EXEC sp_rename 'tableName.column1',' column2' (change the name of the column1 column named tableName to column2)

3. Delete the column:

Alter table tableName drop column columnName

Tags: Name type statement Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS NVidia Apple Shulou Information