Basic operation statement mysql database

1 Change the field name: change

    alter table student change column gradenews grade int(11);

 

2 and increase the field delete field

   alter table  student add column salary int(30) default 900000;

   alter table student drop column salary;

   ALTER TABLE student ADD COLUMN ages  VARCHAR(20) NOT NULL;

   alter table student drop column ages

 

Length modification field 3: modify

  alter table student modify id int(20);

  

 

4 increased batch field

alter table student add (age1 varchar(20), ids int(17), num int(34) default 7546123);

Or use the transaction ways: Transaction needs commit;

 

5 batch modify the name field: change

alter table student change s11 s111 int(7), change s12 s112 int(8) default 2019;

 

6 The number of queries a year

select count(1) from student where grade = 5;

select count(*) from student where grade = 5;

Guess you like

Origin www.cnblogs.com/guofen3399/p/11831350.html