Untitled
unknown
plain_text
a year ago
1.0 kB
10
Indexable
24-01-2024 -------------------------------- DDL ------------------------------ Alter statement: alter statement is used for the modify structre of existing table; alter statement is used for add,rename,modify,drop in an existing tables. 1.change table name syntax:- alter table table_name rename to new_tablename; ex:-alter table student rename to studentinfo; 2. change column name of existing table syntax: alter table table_name rename column oldcolname to newcolname; ex: alter table studentinfo rename column address to addrs; 3. add new column in existing table. syntax:-alter table table_name add column newcolumn_name datatype; exa;- alter table studentinfo add column lname varchar(50); 4.modify datatype of existing column in the tables; syntax:alter table tablename modify column colname newdatatype; exa:-alter table studentinfo modify column gender varchar(10); 5.delete column from existing table syntax :-alter table tablename drop column colname; exa: alter table studentinfo drop column lname;
Editor is loading...
Leave a Comment