SQL 课程 连接查询

  今天,我主要是对前面所学习过的子查询进行了复习,然后学习了连接查询join on 的内容。

  如:

  

select renyuan.code,name,age ,sex , bumen.bname,bceo from renyuan,bumen where renyuan.bc=bumen.bcode

  将以上的查询语句写成连接查询:

select renyuan.code,name,age ,sex , bumen.bname,bceo from renyuan join bumen on renyuan.bc=bumen.bcode

  之后,我学习了局部变量。

  例:

declare @code int
set @code =10003
select age from renyuan where code=@code

posted @ 2016-09-03 20:58  兔小灰385  阅读(115)  评论(0编辑  收藏  举报