西电openguass能力评估1
--常见问题参考:http://mooc1.chaoxing.com/course/227191441.html?edit=false&knowledgeId=undefined&module=10&v=1662175692085#content
--创建表
crate table spj ( sno char(5), pno char(5), jno char(5), qty int, PRIMARY KEY (sno,pno,jno), FOREIGN KEY (sno) REFERENCES s(sno), FOREIGN KEY (pno) REFERENCES p(pno), FOREIGN KEY (jno) REFERENCES j(jno) );
--插入记录
insert into Student values('200215228','陈冬','男',18,'IS');
--查询记录
sele Num from Salary where Salary>3000;
select sno,sname from Student where not(sage>19) and ssex='女';
--更新记录
update Student set Sage=Sage+1;
--删除记录
delect * from Sc where Sno='200215122';
--创建函数:关键字为function
create function get_student_count() return INTEGER AS declare ret INTEGER; BEGIN EXECUTE IMMEDIATE 'select count(*) from student' USING out ret; RETURN ret; end;