Rename column

From SQLZOO
Revision as of 11:06, 17 July 2012 by Marek (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Rename column

schema:scott
DROP TABLE a
 
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
 
ALTER TABLE a CHANGE x y INTEGER;
SELECT * FROM a
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
 
ALTER TABLE a RENAME COLUMN x TO y;
SELECT * FROM a
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
 
ALTER TABLE a RENAME COLUMN x TO y;
SELECT * FROM a
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
ALTER TABLE a RENAME COLUMN x TO y;
USE scott;
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
 
sp_rename 'a.x', 'y', 'COLUMN';
SELECT * FROM a;
NOT possible
CREATE TABLE a(x INTEGER);
INSERT INTO a VALUES (2);
 
ALTER TABLE a RENAME COLUMN x TO y;
SELECT * FROM a
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense