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 :: psql is not recognized 
Sql :: create a table with an id in mysql 
Sql :: delete triger pl pg sql 
Sql :: dao function to check if database contains value 
Sql :: oracle sql drop table 
Sql :: drop procedure sql 
Sql :: postgres get timestamp 
Sql :: pop sql insert value into 
Sql :: sql remove first character from string 
Sql :: sql change password wordpress 
Sql :: copy sql table to another table 
Sql :: postgresql update to unique 
Sql :: apex ORA-20999 
Sql :: postgresql show owner of database 
Sql :: mysql select from outside 
Sql :: oracle view ddl 
Sql :: date_format for time sql 
Sql :: importance of comment in mysql 
Sql :: helptext in sql 
Sql :: add days in oracle sql 
Sql :: sql drop table statement 
Sql :: drop table if exists 
Sql :: import .sql into postgres db command 
Sql :: mariadb number format 
Sql :: mysql query unique column 
Sql :: how to define a composite primary key in sql 
Sql :: mysql remove user privileges 
Sql :: sql select divide column by number 
Sql :: where date major today mysql 
Sql :: make a field auto_increment mysql 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =