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) 添加虚拟表名,只用在相关子查询中

  • 相关阅读:
    mfc给对话框添加背景
    科学计数法中的尾数、基、指数
    格式化输出符号详细说明(待补充)
    写入注册表
    C++ 注册表操作
    Run-Time Check Failure #3
    完美二叉树, 完全二叉树和完满二叉树学习
    GetModuleFileNameW
    [BJDCTF2020]ZJCTF,不过如此
    picoctf_2018_buffer overflow 1/2
  • 原文地址:https://www.cnblogs.com/naqiang/p/5531224.html
Copyright © 2011-2022 走看看