数据库_陈_15.pptx
文本预览下载声明
;Outlines;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;Let us write a function to take a year y and a studio s, and return a boolean that is TRUE if and only if studio s produced at least one black-and-white movie in year y or did not produce any movies at all in that year.
CREATE FUNCTION BandW(y INT, s CHAR(15)) RETURNS BOOLEAN
IF NOT EXISTS(
SELECT * FROM Movie WHERE year = y AND studioName = s)
THEN RETURN TRUE;
ELSEIF 1 =
(SELECT COUNT(*) FROM Movie WHERE year = y AND
studioName = s AND NOT incolor)
THEN RETURN TRUE;
ELSE RETURN FALSE;
END IF;;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39;Exceptions in PSM;Exceptions in PSM;Exceptions in PSM;Example ;Example: Using PSM Function and Procedure;Homework;46;QA
显示全部