一条sql语句可不可以列出两张表里数据?
来源:百度知道 编辑:UC知道 时间:2024/07/07 11:53:11
用一条 select 语句 能不能 同时列出两张表的数据?
select * form a,b
两张表a和b
select * from a,b
where a.id=b.id
这样就可以了。
或者
select * from a
union
select * from b
select * from a
minus
select * from b
当然能!
select * from a表,b表
使得两个表关联的话还有更多参数!
添加where子句让两张表甚至几张表连在一起.
同时列出两张表的数据也就不成问题了.
当然是能的,但这个表却实际上不存在。它叫视图。好好干数据库吧。