Atlas Sub-table

Source: Internet
Author: User
A TLAs Complete the table in the library, using the parameters tables to specify
tables = Test.tb1.id.3
First create three structures to complete the same child table Tb1_0, Tb1_1, tb1_2
CREATE TABLE ' tb1_0 ' (
  ' id ' int () NOT NULL auto_increment,
  ' name ' varchar (255) DEFAULT null,
  ' age ' int (one) D Efault NULL,
  PRIMARY KEY (' id ')
) Engine=innodb DEFAULT Charset=utf8;
Then use TB1 to insert
INSERT into TB1 values (9, ' a ',);
INSERT into TB1 values (ten, ' a ',);
INSERT into TB1 values (one, ' a ', 20);
Querying a child table, data has been taken by ID column table storage
MySQL [test]> SELECT * from Tb1_0;
+----+------+------+
| id | name | age  |
+----+------+------+
|  9 | A    |   |
+----+------+------+

MySQL [test]> select * from Tb1_1;
+----+------+------+
| id | name | age  |
+----+------+------+   | | |
+----+------+------+

MySQL [test]> select * from Tb1_2;
+----+------+------+
| id | name | age  |
+----+------+------+
| |   |
+----+------+------+
Primary Table Query
MySQL [test]> SELECT * from tb1 where ID =11;
+----+------+------+
| id | name | age  |
+----+------+------+
| |   20 |

Limit

1, multirow Insert no table

MySQL [test]> INSERT INTO TB1 values (1, ' a ',), (2, ' B ', D), (3, ' C ',), (4, ' d ',), (5, ' E ',, (6, ' f ',), (7, ' G ', 20) , (8, ' h ',);
MySQL [test]> SELECT * from Tb1_1;
+----+------+------+
| id | name | age  |
+----+------+------+
|  1 | A    |   |
|  2 | b    |   |
|  3 | C    |   |
|  4 | D    |   |
|  5 | E    |   |
|  6 | F    |   |
|  7 | G    |   |
|  8 | H    |   |
| 10 | A    |   |
+----+------+------+
2. Statements that do not add table fields are not supported

MySQL [test]> SELECT * from TB1;
ERROR 1146 (42S02): Table ' test.tb1 ' doesn ' t exist
select * from tb1 where name = ' a ';
ERROR 1146 (42S02): Table ' test.tb1 ' doesn ' t exist
MySQL [test]> select * from tb1 where age =;
ERROR 1146 (42S02): Table ' test.tb1 ' doesn ' t exist
MySQL [test]> update tb1 set age=30 where age =20;
ERROR 1146 (42S02): Table ' test.tb1 ' doesn ' t exist
MySQL [Test]<span id= "Transmark" ></span>> Delete from TB1 where age=20;
ERROR 1146 (42S02): Table ' test.tb1 ' doesn ' t exist
MySQL [test]> update tb1 set age=30;
ERROR 1105 (07000): Proxy warning-syntax Forbidden
3, after the update, the data will not move, still in the atomic table

MySQL [test]> Update tb1 set id=12 where ID =11;
MySQL [test]> SELECT * from Tb1_2;
+----+------+------+
| id | name | age  |
+----+------+------+   | | |
+----+------+------+

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.