MySQL data manipulation: CRUD

MySQL database additions and deletions to change search

By - insert data insert

By INSERT  INTO table (field, ...) values (values, ...);
  INSERT  INTO T1 value ( . 1 , ' Lie ' , ' MALE ' , ' school, homework ' );
  INSERT  INTO T1 values ( 2 , ' Du phase Xi ' , ' MALE ' , ' homework, examination ' );
  INSERT  INTO T1 values ( . 3 , ' B brother ' ,' MALE ' , ' homework ' ), ( 4 , ' Zhuang Bo ' , ' MALE ' , ' test ' );
  INSERT  INTO T1 (username, Hobby) values ( ' Young Port ' , ' school, homework, exam ' ), ( ' Shuai ' , ' test ' )
  INSERT  INTO T2 (ID, name) SELECT ID, username from T1;

Delete - delete data delete

Empty Table
      Delete  from list; 
         empties table, but does not clear the offset (Offset) field increment value 
     TRUNCATE  Table table; 
         will clear the table and increment the offset field 
 delete a piece of data 
     Delete  from table where conditions;

Change - update data update

     update table set field = value where conditions;
      update table set field = value, field = value where the condition;

Search - search query data

  1, single-table queries

  2, even table query

Guess you like

Origin www.cnblogs.com/CatdeXin/p/11069572.html