当前位置: 首页 > news >正文

建设银行 福建分行招聘网站wordpress旧编辑器

建设银行 福建分行招聘网站,wordpress旧编辑器,巴中手机网站建设,360搜索的网站收录入口例题: 创建如下两张表 分别命名为books和persons (1)按照书名,姓名的顺序列出字里包含‘德’字的人物的姓名,书名和字。 select name 姓名,bookname 书名,style 字 from books,persons where style like %德% and bo…

例题:

创建如下两张表 分别命名为books和persons

 

(1)按照书名,姓名的顺序列出字里包含‘德’字的人物的姓名,书名和字。

select name 姓名,bookname 书名,style 字
from books,persons
where style like '%德%'
and books.bookid = persons.bookid
order by 2,1;

order by 2,1:先按照书名排序,书名相同再按照姓名排序:一般是按照首字母排序

 

(2)哪本书中的人物姓名包含最多‘悟’字?
第一种表示方法:

select bookname 书名
from books,persons
where persons.bookid=books.bookid
and name like '%悟%'
group by bookname
having count(books.bookid)=(select top 1 count(bookid)
from persons
where name like '%悟%'
order by count(bookid) desc)

第二种表示方法:

select bookname 书名 from books
where bookid in(
select bookid from persons
where name like'%悟%’
group by bookid
having count(*) =(
select top (1) count(*) from persons
where name like'%悟%’
group by bookid
order by 1 desc))

count(字段)和count(*)的区别:

count(*) 是统计行数,

count(字段) 是统计字段列非null的行数

在查询字段非null时,两者的查询结果是一样的

补充:

count(1)也是统计行数

对于count(1)和count(*)返回的结果是一样的,但是两者的效率在不同的情况下不同:

如果表中没有主键 ,使用count(1)比count(*)快;

如果有主键,那么count(主键)最快

详细的内容,推荐这篇:http://t.csdn.cn/AiVUl

(3)人物最多的书的男性人物的姓名和字是什么

select name 姓名,style 字
from persons
where sex='男'
and bookid in(select bookid from persons
group by bookid 
having count(bookid) =(select top 1 count(bookid) from persons
group by bookid
order by count(bookid) desc))

 

(4)哪本书的人物姓名都是三个字的

select bookname 书名
from books
where bookid not in(select bookid from persons
where name not in(select name from persons where len(name)=3))

(5)女性人物最多的书是哪个朝代的

select dynasty 朝代
from books
where bookid in (
select bookid from persons
where sex ='女’
group by bookid
having count(*)=(
select top(1) count(*) from persons
where sex='女
group by bookid
order by 1 desc

 

 

(6)与唐僧在同一本书的女性人物是谁?

select name 姓名 from books,persons
where books.bookid in(select books bookid from books,persons
where books.bookid=persons.bookid
and name ='唐僧')
and books.bookid=persons.bookid
and sex='女';

(7) 有女性人物但是女性人物最少的书:

select distinct bookname书名,author作者
from books.persons
where books.bookid=persons.bookid
and books.bookid in 
select bookid from persons
where sex ='女'
group by bookid
having count(*) =(
select top(1) count(*)
from persons
where sex='女'
group by bookid
order by 1 asc))

 

http://www.yayakq.cn/news/583143/

相关文章:

  • 太原建设北路小学网站长沙市天心建设局网站
  • 华为网站开发网站制作杭州
  • mvc5网站开发实战详解图片链接在线生成器
  • 注册网站需要多少腾讯云存储 wordpress
  • wordpress视频站模板国际新闻最快最及时的新闻软件
  • 快手作品推广网站广州商城型网站建设
  • 在线科技成都网站推广公司建站比较好的公司
  • 精通网站开发网站开发运营服务合同
  • 太原网站建设培训学校深圳分为哪几个区
  • 做的比较好的游戏网站国内的跨境电商平台有哪些
  • 产品目录网站模板二手商品网站的设计与建设论文
  • 网站建设基本完成网站广告布局
  • 网站开发好后要做什么济南网站设计报价
  • 美食网站开发计划国内精美网站
  • 用php做京东网站页面郓城菏泽网站建设
  • 物流信息网站阿里巴巴免费做网站吗
  • 广州网站建设高端网常州小程序开发公司
  • 网站建设 淘宝描述psd做网站的为什么不给域名和密码
  • 网站要不要备案做python项目的网站
  • 网站准确的定位土豆网网站开发源代码
  • 做引流去那些网站好wordpress 微信同步
  • 租用空间做网站不锈钢网片
  • 互联网教育网站开发多城市网站设计
  • 网站建设的书籍有哪些wordpress自动留言
  • 美食网站建设电子商务网站建设论文3000字
  • 怎么用阿里云服务器做淘客网站goland 网站开发
  • wordpress的数据库主机唐山seo推广
  • 网站建设术语电商网站 编程语言
  • 福州房产网站建设天眼
  • linux用.net做网站建设一个国外服务器的网站