create table a (name varchar(20) not null,sex varchar(10))
create table b (name varchar(20) not null,sex varchar(10))
2、插入值
insert into a values('john','male')insert into b values('john','male')
insert into a values('kate','female')insert into b values('kate','female')
3、查询方法1
mysql>select name,sex from a where name in (select name from b where name='john')
+------+------+
| name | sex |
+------+------+
| john | male |
+------+------+
1 row in set (0.00 sec)
4、查询方法2
mysql>select a.name,a.sex from a,b where a.name=b.name and b.name='john'
+------+------+
| name | sex |
+------+------+
| john | male |
+------+------+
1 row in set (0.00 sec)
DBLE是一种分布式数据库。
DBLE官方网站:https://opensource.actionsky.com
DBLE官方项目:https://github.com/actiontech/dble
DBLE下载地址:https://github.com/actiontech/dble/releases
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)