SQL 多表查询代码示例 在 Pubs 数据库中,完成以下查询use pubs—-使用内联接查询出 authors 和 publishers 表中位于同一个城市的作者和出版社信息select au_fname+'·’+au_lname as 作者,pub_name as 出版社from authors inner join publisherson authors
city=publishers
city--查询出作者号以 1~5 开头的所有作者,并使用右外联接在查询的结果集中列出和作者—-在同一个城市的出版社名select au_fname+'·'+au_lname as 作者,pub_name as 出版社from authors right outer join publisherson authors
au_id like ’[1-5]%' where authors
city=publishers
city——使用自联接查找居住在 Oakland 相同邮码区域中的作者
select distinct a
au_fname+'·’+a
au_lname as 作者,a
au_id,a
zipfrom authors a inner join authors bon a
zip = b
zipwhere a
city=’Oakland’ and a
au_fname 〈〉 b
au_fname-—P26《学习手册》上机试验的所有题目select ascii('sql’)-—结果:115select char(66)--结果:Bselect charindex('E’,'HELLO’)-—结果:2select left('RICHARD',4)——结果:RICHselec