zoukankan      html  css  js  c++  java
  • SQL练习题

    5.

    表中的数据已提前插入

    use SPJ;
    (1)select SNAME, CITY from St;
    (2)select PNAME, COLOR, WEIGHT from P;
    (3)select PNO from SPJ where SNO = 'S1';
    (4)select PNAME, QTY from P, SPJ where SPJ.JNO = 'J2' and SPJ.PNO = P.PNO;
    select * from St;
    select * from SPJ;
    select * from P;
    update St set SNO = 'S4' where SNAME = '丰盛泰';
    (5)select PNO from SPJ, St where SPJ.SNO = St.SNO and St.CITY = '上海';
    select PNO from SPJ where SPJ.SNO in (select SNO from St where CITY = '上海'); //同上
    (6)select distinct JNAME from J where JNO in (select JNO from SPJ where SNO in(select SNO from St where CITY = '上海'));
    select distinct J.JNAME from J, SPJ, St where J.JNO = SPJ.JNO and SPJ.SNO = St.SNO and St.CITY = '上海';//同上
    (7)select JNO from SPJ, St where St.SNO = SPJ.SNO and St.CITY = '天津'; //不会用这种表示
    //select distinct JNO from SPJ where SNO not in (select SNO from St where CITY = '天津');
    (8)update P set COLOR = '蓝' where COLOR = '红';
    (9)update SPJ set SNO = 'S3'where SNO = 'S5' and PNO = 'P6' and JNO = 'J4';
    (10)delete * from St where SNO = 'S2';
    (10)delete * from SPJ where SNO = 'S2';
    (11)insert into SPJ values('S2','J6','P4',200);

    9.(1)
    create view SJ as select SNO, PNO, QTY from J, SPJ where J.JNO = SPJ.JNO and J.JNAME = '三建';
    select distinct * from SJ where SNO = 'S1';

  • 相关阅读:
    (打包报错)AS打包报错:Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view.
    NABCD
    石家庄地铁站项目最终总结报告
    团队冲刺2.7
    团队冲刺2.6
    团队冲刺2.5
    团队冲刺2.4
    团队冲刺2.3
    用户体验评价——win10自带微软拼音输入法
    团队冲刺2.2
  • 原文地址:https://www.cnblogs.com/AGoodDay/p/10774039.html
Copyright © 2011-2022 走看看