Index: S.No. Experiment Date Signature Remarks
Index: S.No. Experiment Date Signature Remarks
Index: S.No. Experiment Date Signature Remarks
INDEX
Date: 16-04-2020
PROGRAM No. 1
Code:
Query for creating the table:
CREATE TABLE Employee(ID Varchar(100), FirstName varchar(100),
Lastname varchar(100), startdate date, enddate date, salary integer,
city varchar(100), description varchar(100));
Date: 16-04-2020
Output:
COLLEGE OF TECHNOLOGY AND ENGINEERING, UDAIPUR
Date: 17-04-2020
PROGRAM No. 2
Code:
.)a ). Query for calculating the area of circle:
CREATE FUNCTION circle_area(radius INTEGER) RETURNS
INTEGER AS $$
BEGIN
RETURN 3.14*POWER(radius, 2);
END;
$$ LANGUAGE PLPGSQL;
Date: 17-04-2020
Output:
COLLEGE OF TECHNOLOGY AND ENGINEERING, UDAIPUR
Date: 17-04-2020
COLLEGE OF TECHNOLOGY AND ENGINEERING, UDAIPUR
Date: 18-04-2020
PROGRAM No. 3
Code:
CREATE OR REPLACE FUNCTION func()
RETURNS void AS
$$
BEGIN
RAISE NOTICE 'This is function func()';
END;
$$ language plpgsql;
Output:
COLLEGE OF TECHNOLOGY AND ENGINEERING, UDAIPUR
Date: 18-04-2020
PROGRAM No. 4
Code:
CREATE FUNCTION factorial(num INTEGER)
RETURNS INTEGER AS $$
BEGIN
if num = 1
then RETURN 1;
else RETURN (num*factorial(num-1));
end if;
END;
$$ language plpgsql;
Output: