MyDB Database MyDB Date: 2000-12-31. COMMENT ON DATABASE mydb IS 'Write comment here' Objects List of tables List of Tables customer inventory List of views List of Views custview invenview List of functions List of Functions getid(text) Tables Table Table: customer Table customer COMMENT ON TABLE customer IS 'Write comment here' customer Column Type Description custid int4 COMMENT ON COLUMN customer.custid IS 'Write comment here' name text COMMENT ON COLUMN customer.name IS 'Write comment here'
Table: inventory Tables inventory COMMENT ON TABLE inventory IS 'Write comment here' inventory Column Type Description invid int4 COMMENT ON COLUMN inventory.invid IS 'Write comment here' name text COMMENT ON COLUMN inventory.name IS 'Write comment here'
Views Views View: custview View custview COMMENT ON VIEW custview IS 'Write comment here' CREATE VIEW custview AS 'SELECT * FROM customer WHERE name=''John''' View: invenview View invenview COMMENT ON VIEW invenview IS 'Write comment here' CREATE VIEW invenview AS 'SELECT * FROM inventory WHERE name=''Chair''' Functions Function: getid(text) Function getid(text) COMMENT ON FUNCTION getid(text) IS 'Write comment here' CREATE FUNCTION getid(text) RETURNS INT4 AS ' DECLARE p_name ALIAS FOR $1; id INT4; BEGIN SELECT custid INTO id FROM customer WHERE name=p_name; IF NOT FOUND THEN RETURN 0; END IF; RETURN id; END; ' LANGUAGE 'PGplSQL';