This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- model inheritance in database | |
-- table per type | |
-- https://stackoverflow.com/a/190306 | |
CREATE TABLE users ( | |
id SERIAL, | |
email VARCHAR(50) NOT NULL, | |
password VARCHAR(20) NOT NULL, | |
PRIMARY KEY (id) |
- if you perform an inner join between the two tables customer and order, the result will contain a row for each combination of customer and order
- for instance, if you have 3 customers and each customer has 2 orders, the total number of rows in the result would be 6 (the same quantity of rows in the orders table)
- in a one-to-many relationship, when you perform an inner join between the "one" table and the "many" table, the number of rows in the result will be equal to the number of rows in the "many" table
- if you need to include the NULL values from the "one" table in a one-to-many relationship, you can use an outer left join
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS primary_keys; | |
CREATE TABLE primary_keys ( | |
table_name varchar(25) NOT NULL, | |
colnames text[] NOT NULL | |
); | |
-- https://www.enterprisedb.com/postgres-tutorials/how-use-event-triggers-postgresql | |
-- https://gist.github.com/Checksum/5942ad6a38e75d71e0a9c0912ac83601 | |
CREATE OR REPLACE FUNCTION handle_CREATE_TABLE_fn() | |
RETURNS event_trigger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1tnw45g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="12.0.0"> | |
<bpmn:collaboration id="Collaboration_0ldzokh"> | |
<bpmn:participant id="Participant_1y3ubez" name="Gestão da Manutenção" processRef="Process_0gglgjk" /> | |
<bpmn:participant id="Participant_13d1tnq" name="Compras" processRef="Process_1j3kbkf" /> | |
<bpmn:messageFlow id="Flow_14ayo9j" name="Requisitos de aquisição para manutenção" sourceRef="Activity_1cxz70v" targetRef="Participant_13d1tnq" /> | |
</bpmn:collaboration> | |
<bpmn:process |