MySQL multi-table operations and batch processing methods (3) _ MySQL-mysql tutorial

Source: Internet
Author: User
MySQL multi-table operations and batch processing methods (3) 3. add Records

We have already discussed how to add a record to repeat this record for ease of viewing:

  

Mysql> insert into mytable
-> Values ('ABC', 'F', '1966-08-17', 'China', 'n ′);
Query OK, 1 row affected (0.05 sec)


Check it out:

Mysql> select * from mytable;
+ ---------- + ------ + ------------ + ----------- + -------- +
| Name | sex | birth | birthaddr | single |
+ ---------- + ------ + ------------ + ----------- + -------- +
| Abccs | f | 1977-07-07 | china | y |
| Mary | f | 1978-12-12 | usa | NULL |
| Tom | m | 1970-09-02 | usa | NULL |
| Abc | f | 1966-08-17 | china | n |
+ ---------- + ------ + ------------ + ----------- + -------- +


4. delete records

Run the following command to delete a record in the table:


Mysql> delete from mytable where name = 'abc ′;


DELETE: DELETE a record from the table that meets the conditions given by where.

The result is displayed as follows:

Mysql> select * from mytable;
+ ---------- + ------ + ------------ + ----------- + -------- +
| Name | sex | birth | birthaddr | single |
+ ---------- + ------ + ------------ + ----------- + -------- +
| Abccs | f | 1977-07-07 | china | y |
| Mary | f | 1978-12-12 | usa | NULL |
| Tom | m | 1970-09-02 | usa | NULL |
+ ---------- + ------ + ------------ + ----------- + -------- +


5. delete a table:

Mysql> drop table ***** (name of table 1), and *** name of table 2;

You can delete one or more tables with caution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.