Home > Database > Mysql Tutorial > body text

mysql 选择插入数据(包含不存在列)具体实现_MySQL

WBOY
Release: 2016-06-01 13:25:22
Original
1059 people have browsed it

bitsCN.com mysql> select 'name',id from table_b; //'name' 不在table_b表中
+------+-----------+
| name | id |
+------+-----------+
| name | 123456 |
| name | 1234567 |
| name | 12345678 |
| name | 123456789 |
+------+-----------+
4 rows in set (0.00 sec)


mysql> insert into table_a(name,b_refer) select 'name', id from table_b; //'name' 不在table_b表中
Query OK, 4 rows affected (0.03 sec)
bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!