'alter' is a SQL keyword used to change or modify the table structure or the records in a table.
Questions tagged [alter]
835 questions
5
votes
1 answer
Exact behavior of ADD COLUMN with CASCADE in Hive
Suppose the next table:
sch_test.test_cascade
a b c
-----------
6 10 1
6 10 1
6 10 2
6 10 2
a, b and c are integers and the table is partitioned by c.
When I add a column in Hive with…

Amanda
- 941
- 2
- 12
- 28
5
votes
2 answers
Cassandra add column after particular column
I need to alter the table to add a new column after a particular column or as last column, I have been through the document but no luck.

Siva
- 3,297
- 7
- 29
- 35
5
votes
2 answers
Creating calculated fields in sql
This will seem rudimentary but I can't find a concise example online that matches up.
I have three fields; m1, m2, and m3. I need to create a column or field that is the average of them three. The calculated field would be titled employment. Would…

Tim Wilcox
- 1,275
- 2
- 19
- 43
5
votes
1 answer
how to add column in a sqlite table in SWIFT
I try to add a column in a table with swift.
my code :
connect_db();
adddbfield("mynewfield","mytable");
.
func connect_db() -> Bool {
let sDBPath=;
if sqlite3_open(sDBPath, &db) != SQLITE_OK {
println("Failed…

mcfly soft
- 11,289
- 26
- 98
- 202
5
votes
2 answers
Why COMMIT resolved the issue after execute immediate?
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET SKIP_UNUSABLE_INDEXES = TRUE';
EXECUTE IMMEDIATE 'ALTER SESSION DISABLE PARALLEL DML' ;
END;
/
getting following error in 1 out of 3 oracle servers. oracle : 11.2.0.4
ora 12841 cannot alter the…

Bhabuk Kunwar
- 53
- 1
- 6
5
votes
3 answers
How can I assign a new char into a string in Go?
I'm trying to alter an existing string in Go but I keep getting this error "cannot assign to new_str[i]"
package main
import "fmt"
func ToUpper(str string) string {
new_str := str
for i:=0; i='a' &&…

user3765713
- 133
- 2
- 13
5
votes
6 answers
Can a primary key be empty? If yes why did this alter cause this result?
I have the following table:
mysql> DESC my_contacts;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id |…

Cratylus
- 52,998
- 69
- 209
- 339
4
votes
2 answers
How to alter table when full text search is enabled?
I have address table in which city field have nvarchar datatype, but I want to change datatype nvarchar to varchar. For that I have write the script
ALTER TABLE Address ALTER COLUMN City varchar(50) null
but when I execute this I have got the…

pramod
- 53
- 1
- 3
4
votes
1 answer
When was my table last ALTERed?
I'm using mysql 5.1.41-3ubuntu12.10 and would like to know when my table was last ALTERed (or CREATEd, if it was never ALTERed).
SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = SCHEMA();
gives the CREATE and last UPDATE time, but not…

msh210
- 256
- 6
- 23
4
votes
4 answers
MYSQL 5.5 Drop Primary Key
I am upgrading my quartz.net version from 1.0.3 to 2.0.2
There is a migration script for database schema, which was was written for MSSQL, and I am trying to write a MYSQL version of it.
However, I haven't been able to drop primary keys (which I…

SadullahCeran
- 2,425
- 4
- 20
- 34
4
votes
3 answers
How to rename multiple columns in oracle using one Alter table statement?
The only thing I found is renaming one column at a time:
ALTER TABLE table_name
RENAME COLUMN old_name TO new_name;
I read Oracle documentations, and couldn't get the answer for many columns at a time .
Ref:…

Amin
- 41
- 1
- 1
- 4
4
votes
1 answer
Can i undo ALTER table in - MySQL?
Don't know if it's possible, I Altered VARCHAR column to Decimal Type which i want to Rollback. Because it blended all floating values as integer. like 2.00 became 200. Is there any way to undo my last table Alteration? Please advise.

RanaHaroon
- 445
- 6
- 20
4
votes
2 answers
Alter huge MySQL table with little free disk space
I'm having some trouble to ALTER a huge (InnoDB) MySQL table. The ID column of the table (which is the primary key) is defined as an UNSIGNED INT but reached it's maximum value (4294967295).
To be able to add more rows to this table, I need to…

user1834095
- 5,332
- 2
- 20
- 38
4
votes
2 answers
How to set default value to existing rows while adding new column with default value to table
I have table with 100 rows and I am adding new column with default value as show below.
ALTER TABLE AccountDetails
ADD
UpdatedOn DATETIME DEFAULT GETDATE(),
UpdatedBy VARCHAR(50) DEFAULT 'System'
After execution of this…

He llo
- 129
- 1
- 4
4
votes
1 answer
alter hive multiple column
How do we alter the datatype of multiple columns in Hive ?
CREATE TABLE test_change (a int, b int, c int);
ALTER TABLE test_change CHANGE a a string b b doube c c decimal(11,2);

Vinodh Sukumaran
- 41
- 1
- 3