zoukankan      html  css  js  c++  java
  • 高级查询几种方法

    1.连接查询 1)逗号 ,where select * from Info,nation #笛卡尔积 表与表之间链接在from后面,逗号分开 selsct *(info.code,info.name.sex,nation.name,info.birthday) from Info,nation where Info .nation=nation.cod筛选出自己的项目 2)关键字 join on select * from info join nation

    select * from info join nation on info.nation=nation.code join和on是一对 2.联合查询 对行的扩展 select code name from info union select code name from Nation联合查询注意code name 列的结构,列名必须一样 3.子查询 1)无关子查询

    外层查询(里层查询) 子查询的结果当做父查询的条件

    子查询:select code from nation where name=‘汉族’ 父查询:select * from info where nation=‘’ 结合;select * from info where nation =(select code from nation where name=‘汉族’)

    2)相关子查询 查询汽车表中油耗低于该系列平均油耗的所有汽车信息 父查询:select * from car where oil<(该系列平均油耗) 子查询:select avg(oil)from car where brand=‘某个系列’ select * from car a where oil<(select svg(oil)from car b where b.brand=a.brand) 添加虚拟表名,只用在相关子查询中

  • 相关阅读:
    手机各种JS语法,随时更新
    ionic上拉加载-下拉刷新
    JS获取浏览器信息及屏幕分辨率
    jQuery元素的显示、隐藏及动画
    jQuery原型
    表单序列化为对象
    html里的ajax数据传输
    面试技巧-互联网行业通吃
    jquery表单验证validate
    Javascript缓动动画原理
  • 原文地址:https://www.cnblogs.com/naqiang/p/5531224.html
Copyright © 2011-2022 走看看