prueba tecnica
This commit is contained in:
23
db/03_GetAllContracts.sql
Normal file
23
db/03_GetAllContracts.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
DROP FUNCTION IF EXISTS public.get_contracts();
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.get_contracts()
|
||||
RETURNS TABLE (
|
||||
Id INTEGER,
|
||||
ContractorName VARCHAR,
|
||||
ContractorSurname VARCHAR,
|
||||
ContractInitDate TIMESTAMP,
|
||||
RateName VARCHAR
|
||||
)
|
||||
AS $$
|
||||
SELECT
|
||||
c.id,
|
||||
c.contractorname,
|
||||
c.contractorsurname,
|
||||
c.contractinitdate,
|
||||
r.name AS RateName
|
||||
FROM public.contracts AS c
|
||||
JOIN public.rates AS r
|
||||
ON r.id = c.rateid
|
||||
ORDER BY c.id;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
Reference in New Issue
Block a user