請問(D)有什麼辦法可以做出來嗎
網路爬文都沒有結果
請求幫助
2. (40%) Choose a DBMS (e.g., SQL Server, Oracle or MySQL) to create and populate the tables in problem 1.
(a) (10%) Show your SQL statements and the execution results (screen snapshots)
for creating the tables. The SQL statements need to specify the key and
referential constraints (i.e., primary key and foreign key) for each table.
(b) (10%) Populate the tables so that each table contains at least 3 tuples. Show your SQL insertion statements and the execution results (screen snapshots)
for populating the tables.
(c) (10%) Perform the SQL queries in problem 1 in your DBMS. Show your
SQL statements and the execution results (screen snapshots). Note that your
SQL query results MUST NOT contain no tuples.
(d) (10%) Based on the DB in problem 1, write a stored procedure (can be functions or procedures) that reads student’s number and prints the average grade of the student. Show the source code and the execution results (screen snapshots) of your stored procedure.
不清楚你的数据库table三元组怎么设计,我之前搞过个类似的,python+mysql学生案例 的简单尝试,你可以参考学习下
https://blog.csdn.net/weixin_44001521/article/details/120357046
DELIMITER //
CREATE FUNCTION GetStuGrdAvgByID( StuId VARCHAR(20) )
RETURNS VARCHAR(300)
BEGIN
RETURN(SELECT AVG(grade) FROM GRADE_REPORT WHERE StudentNumber=StuId);
END//
DELIMITER ;
SELECT GetStuGrdAvgByID('201');
这种问题应该先提供一下你的表结构吧