Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Mysql query add column with default string value

ALTER TABLE `table_name` ADD COLUMN `new_column_name` VARCHAR(255)  DEFAULT "DEFUALT_VALUE" AFTER `COLUMN_NAME`;
Comment

mysql add column default value

ALTER TABLE table1 ADD COLUMN foo INT DEFAULT 0;
Comment

mysql add column with default value

-- ALTER TABLE tbl_name ADD COLUMN column_name column_definition 
--		[FIRST|AFTER existing_column];
ALTER TABLE office ADD COLUMN phone VARCHAR(200) DEFAULT '000' AFTER name;
ALTER TABLE office ADD COLUMN flag INT(1) FIRST;
ALTER TABLE office ADD COLUMN last_col INT(2);	-- Last column is default position
-- ↓ Test it (Fiddle)
Comment

PREVIOUS NEXT
Code Example
Sql :: how to remove characters from string in mysql 
Sql :: drop view in mysql 
Sql :: sql several or 
Sql :: Row Number is sql server 
Sql :: create table oracle 
Sql :: ms sql rename database 
Sql :: reset identity column in sql server 
Sql :: postgres install unaccent extension 
Sql :: mysql backup 
Sql :: oracle sql log to console 
Sql :: sql last 7 days 
Sql :: microsoft sql server extract hour and minute from datetime 
Sql :: oracle list dblink 
Sql :: postgres change column type string to integer 
Sql :: search for tables with name postgresql 
Sql :: ORA-01950 
Sql :: ver usuarios mysql 
Sql :: connect python to mysql 
Sql :: timestamp in sqlite 
Sql :: delete a view sql 
Sql :: alter sequence restart with postgresql 
Sql :: mysql date between two dates 
Sql :: dao function to check if database contains value 
Sql :: postgresql define pk sequence next number 
Sql :: cursor in sql server 
Sql :: laravel migration sql dump 
Sql :: sql server pagination 
Sql :: ddl materialized view 
Sql :: how to describe a table in sqlite3 
Sql :: ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =