Main content:
- Inserting data Insert
- Updating Data Update
- Deleting data Delete
Again to review some of the operations we have done before, I believe we all have a comprehensive understanding of inserting data, updating data, deleting data. So the most important thing in MySQL is not the three operations, but the most important to check the data.
In MySQL management software, you can use the DML language in SQL statements to implement data manipulation, including1inserting data by using Insert2. Update to implement data updates3. Using Delete to implement data deletion4. Use Select to query data and. Second, insert dataINSERT1Insert full data (sequential insert) syntax one:INSERT intoTable name (field 1, Field 2, Field 3 ...) Field N)VALUES(value 1, value 2, value 3 ...) Value n); Syntax Two:INSERT intoTable nameVALUES(value 1, value 2, value 3 ...) Value n);2. Specify fields to insert data syntax:INSERT intoTable name (field 1, Field 2, Field 3 ...)VALUES(value 1, value 2, value 3 ...);3. Insert multiple record syntax:INSERT intoTable nameVALUES(value 1, value 2, value 3 ...) Value n), (value 1, value 2, value 3 ...) Value n), (value 1, value 2, value 3 ...) Value n); 4. Insert query result syntax:INSERT intoTable name (Field 1, Field 2, Field 3 ...) Field N)SELECT(Field 1, Field 2, Field 3 ...) Field N) fromTable 2WHERE...; Updating the data update syntax:UPDATETable nameSETField 1=value 1, field 2=value of 2,WHERECONDITION; Example:UPDATEMysql.User SETPassword=Password ('123')where User=' Root ' andHost=' localhost '; Delete data delete syntax:DELETE fromTable nameWHEREconition; Example:DELETE fromMysql.User WHEREPassword=’’;
MySQL database--Data deletion and modification