Multi-table operation and backup processing of MySQL

Source: Internet
Author: User
Tags backup

Multi-table operations

In a database, there may be multiple tables, all of which are interrelated. We continue to use the previous example. The table previously established contains some basic information about the employee, such as name, sex, date of birth, place of birth. We'll create a table that describes the articles published by the employee, including the author's name, the title of the article, and the date of publication.

1, view the contents of the first table mytable:

mysql> select * from mytable;
  +----------+------+------------+-----------+
  | name   | sex  | birth     | birthaddr | 
   +----------+------+------------+-----------+
  | abccs   |   f  | 1977-07-07 | china |
  | mary  |f | 1978-12-12 | usa |
  | tom   |m | 1970-09-02 | usa |
  +----------+------+------------+-----------+

2, create a second table title (including author, article title, Publication date):

mysql> create table title(writer varchar(20) not null,
  -> title varchar(40) not null,
  -> senddate date);

Add a record to the table, and the final table reads as follows:mysql> select * from title;
  +--------+-------+------------+
  | writer | title | senddate |
  +--------+-------+------------+
  | abccs | a1 | 2000-01-23 |
  | mary | b1 | 1998-03-21 |
  | abccs | a2 | 2000-12-04 |
  | tom | c1 | 1992-05-16 |
  | tom | c2 | 1999-12-12 |
  +--------+-------+------------+
  5 rows in set (0.00sec)

Related Article

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.