Student3_4

package com.shrimpking.t9;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Shrimpking
 * @create 2024/9/26 16:47
 */
public class Student3_4
{
    static int ageMax = 100; //类变量
    String name;  //成员变量

    //无参构造方法
    public Student3_4(){
        this.name = "zhang";
    }

    //类方法
    public static int getAgeMax(){
        return ageMax;
    }

    //对象实例方法
    public void display(){
        System.out.println("我是display方法的打印语句");
    }

    public static void main(String[] args)
    {
        Student3_4 stu = new Student3_4(); //实例化
        stu.display(); //调用实例方法
        int age = Student3_4.getAgeMax(); //调用类方法

    }
}

很好,这些都是关于数据库的问题。以下是每个问题的回答: 1. 创建视图V_Student_1: ```sql CREATE VIEW V_Student_1 AS SELECT * FROM Student WHERE Sage = 18; ``` 2. 创建视图V_Student_2: ```sql CREATE VIEW V_Student_2 AS SELECT Sno, AVG(Score) AS AvgScore FROM SC GROUP BY Sno; ``` 3. 创建视图V_Course_1: ```sql CREATE VIEW V_Course_1 AS SELECT Cno, Cname FROM Course WHERE Ccredit = 4; ``` 4. 创建视图V_Student_3: ```sql CREATE VIEW V_Student_3 AS SELECT S.Sname, C.Cname, SC.Score FROM Student S, Course C, SC WHERE S.Sno = SC.Sno AND C.Cno = SC.Cno; ``` 5. 创建视图V_Student_4: ```sql CREATE VIEW V_Student_4 AS SELECT S.Sno, S.Sname, S.Sex, S.Sage FROM Student S, Department D WHERE S.Dno = D.Dno AND D.Dname = '经济管理学院'; ``` 6. 删除视图V_Student_2: ```sql DROP VIEW V_Student_2; ``` 7. 查询V_Student_4中年龄小于20岁的学生信息: ```sql SELECT * FROM V_Student_4 WHERE Sage < 20; ``` 8. 将V_Student_4中所有学生的年龄加1: ```sql UPDATE V_Student_4 SET Sage = Sage + 1; ``` 9. 为表Course在Cname上创建非主簇索引i_Course: ```sql CREATE NONCLUSTERED INDEX i_Course ON Course(Cname); ``` 10. 为表Student在Sname和Sage上创建非主簇索引i_Student: ```sql CREATE NONCLUSTERED INDEX i_Student ON Student(Sname, Sage); ``` 11. 为表SC在Sno和Cno上创建唯一索引i_SC: ```sql CREATE UNIQUE INDEX i_SC ON SC(Sno, Cno); ``` 12. 使用SP_HELPINDEX查看Student关系的所有类型的索引: ```sql EXEC sp_helpindex 'Student'; ``` 13. 将i_Student索引的名字改为i_Student_1: ```sql EXEC sp_rename 'Student.i_Student', 'i_Student_1', 'INDEX'; ``` 14. 删除索引i_Course: ```sql DROP INDEX i_Course ON Course; ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虾米大王

有你的支持,我会更有动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值