Skip to main content

SQL ALTER TABLE Statement

ALTER Statement

To add a column in a table:
ALTER TABLE table_name
ADD column_name datatype;
To delete a column in a table:
ALTER TABLE table_name
DROP COLUMN column_name;
To change the data type of a column in a table:
ALTER TABLE table_name
MODIFY COLUMN column_name datatype;
To add default value for a column in a table:
ALTER TABLE table_name
ALTER column_name SET DEFAULT 
value;
To remove default value of a column in a table:
ALTER TABLE table_name
ALTER column_name DROP DEFAULT
;






Comments

Popular posts from this blog

session_start(): Failed to initialize storage module: user (path: )

Error: session_start(): Failed to initialize storage module: user (path: ) Solution: When this error is given for the Codeigniter project you are running, that is specifically for not having a path recognised to store session data. Set config data as follows [file: your-project-folder/application/config/config.php] : $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = APPPATH.'cache/'; $config['sess_match_ip'] = TRUE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE;