zoukankan      html  css  js  c++  java
  • 数据库---高级查询

    高级查询:
        一:多表连接
        1.select Info.Code,Info.Name,Nation.Name from Info,Nation where Info.Nation = Nation.Code
        select * from Info,Nation

        2.join连接
        select * from Info join Nation on Info.Nation = Nation.Code
        
        二:多表联合
        select * from Info where Code='p001'union select * from Info where Nation='n001'

        三:子查询(无关子查询)
        select * from Info where Nation = (select Code from Nation where Name='汉族')
        select * from Info where Nation in (select Code from Nation where Name='汉族' or Name='苗族')

        四:子查询(相关子查询)
        select * from Car a  where a.Oil <(select avg(Oil) from Car b where b.Brand = a.Brand)


        
       

  • 相关阅读:
    第一次个人编程作业
    第一次结对编程作业
    第一次编程作业——地址簿
    我的第一次博客作业
    团队作业1
    作业一
    寒假作业四
    寒假作业三
    第二次寒假作业
    电梯
  • 原文地址:https://www.cnblogs.com/0927wyj/p/5139528.html
Copyright © 2011-2022 走看看