Top "Alter-table" questions

The "ALTER TABLE" is a SQL statement that allows you to make schema changes to a database table (i.e. add, drop or alter columns from an existing table).

How to rename a table in SQL Server?

The SQL query that I have used is : ALTER TABLE oldtable RENAME TO newtable; But, it gives me an error. …

sql-server rename alter-table
Alter a MySQL column to be AUTO_INCREMENT

I’m trying to modify a table to make its primary key column AUTO_INCREMENT after the fact. I have …

sql mysql alter-table
Alter column, add default constraint

I have a table and one of the columns is "Date" of type datetime. We decided to add a default …

sql-server sql-server-2008 tsql alter-table alter-column
ALTER TABLE to add a composite primary key

I have a table called provider. I have three columns called person, place, thing. There can be duplicate persons, duplicate …

mysql sql primary-key alter-table composite-primary-key
ALTER table - adding AUTOINCREMENT in MySQL

I created a table in MySQL with on column itemID. After creating the table, now I want to change this …

mysql sql alter-table
How can I modify the size of column in a MySQL table?

I have created a table and accidentally put varchar length as 300 instead of 65353. How can I fix that? An example …

mysql database alter-table
How can I add a column that doesn't allow nulls in a Postgresql database?

I'm adding a new, "NOT NULL" column to my Postgresql database using the following query (sanitized for the Internet): ALTER …

sql postgresql alter-table
How to change MySQL column definition?

I have a mySQL table called test: create table test( locationExpect varchar(120) NOT NULL; ); I want to change the locationExpect …

mysql alter-table
Postgresql - change the size of a varchar column to lower length

I have a question about the ALTER TABLE command on a really large table (almost 30 millions rows). One of its …

sql postgresql varchar alter-table
insert a NOT NULL column to an existing table

I have tried: ALTER TABLE MY_TABLE ADD STAGE INT NOT NULL; But it gives this error message: ALTER TABLE …

sql-server alter-table notnull