Search
 
SCRIPT & CODE EXAMPLE
 

SQL

change column names mssql

--The following example renames the column TerritoryID in the table Sales.SalesTerritory to TerrID in the AdventureWorks database.

EXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';
Comment

change name of colum in sql table

ALTER TABLE "table_name" RENAME COLUMN "column 1" TO "column 2";
Comment

change column name in sql

MySQL:
ALTER TABLE Customer CHANGE Address Addr char(50);

Oracle:
ALTER TABLE Customer RENAME COLUMN Address TO Addr;
Comment

how to change column name in sql

ALTER TABLE Student RENAME COLUMN NAME TO FIRST_NAME;
ALTER TABLE `Table Name` MODIFY COLUMN `Column Name` Datatype(Size);
Comment

how to change a collumn name in sql

ALTER TABLE `table_name` 
CHANGE `old_name` `new_name` VARCHAR(10) 
CHARACTER SET utf8 
COLLATE utf8_general_ci NULL 
DEFAULT NULL;
Comment

modify column name in sql

ALTER TABLE `Table Name` MODIFY COLUMN `Column Name` Datatype(Size);
Comment

sql alter column name sql server

EXEC sp_RENAME 'table_name.oldColumn_name' , 'newColumn_name', 'COLUMN'
Comment

change column name sql

ALTER TABLE `db_name`.`table_name` 
	CHANGE `current_column_name` `new_column_name` datatype(size) NOT NULL COMMENT '';
Comment

sql change column name based on value

SELECT CASE lower(col1)
	WHEN 'agree' THEN 'Ok'
    ELSE
        CASE 
            WHEN col2 = 1 THEN 'Ko'
            ELSE 'Maybe'
        END
END AS my_result
FROM table_name;
Comment

changing column names in sql query results

SELECT NAME AS "Employee Name" FROM PEOPLE;

SELECT p.NAME AS "Employee Name", s.SALARY AS "Employee Salary"
FROM PEOPLE p
JOIN SALARIES s ON p.ID = s.ID;
Comment

PREVIOUS NEXT
Code Example
Sql :: sql rownum 
Sql :: postgresql having 
Sql :: carbon mysql d m y to y-m-d 
Sql :: add sqlite3 in lumen 
Sql :: find the all the constraints in a specific table 
Sql :: left join in sql oracle 
Sql :: oracle last connection 
Sql :: how to check which table has data in mysql 
Sql :: oracle list chain steps 
Sql :: find most frequent word in sql server 
Sql :: oracle list partitioned tables 
Sql :: logical operators in sql 
Sql :: psql attribute cannot login 
Sql :: psql concat string and int 
Sql :: tsql from yyyymm to date 
Sql :: one to one and one to many relationship 
Sql :: alter database datafile maxsize 32g 
Sql :: how to update linked server in sql server 
Sql :: how to connect sqlalchemy to mysql and deploy it 
Sql :: sql where multiple values 
Sql :: Create parameterized VIEW in SQL Server 
Sql :: automate mysql cli query 
Sql :: how to get the previous day on mysql 
Sql :: mysql undo delete 
Sql :: postgresql create user roles 
Sql :: mysql earlier than date 
Sql :: clustered-nonclustered indexes(constraints) 
Sql :: creating database with - 
Sql :: postgresql add not null and not empty constraint 
Sql :: primary key with prefix sql 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =