PL-PgSQL (Lesson 9) - Arrays in PostgreSQL - Declaration, Assignment, and Examples

Pubblicato il: 11 gennaio 2021
sul canale di: DesCOMPlica, Oliba!
2,491
118

In this video, Professor Olibário explains the main concepts about arrays in PostgreSQL. Examples are given and an exercise is implemented using the PgAdmin IDE. If you like the video, please click "Like," subscribe to our channel, and activate the notification bell so you don't miss any of our content. Together we will learn and bring knowledge to more people!

Script for testing:
CREATE TABLE DEPARTMENT (
department_number INTEGER,
department_name VARCHAR(20),
PRIMARY KEY (department_number)

);

CREATE TABLE EMPLOYEE (
code_emp INTEGER,
p_name VARCHAR(15) NOT NULL,
surname VARCHAR(30),
dt_niver DATE,
end_emp VARCHAR(50),
CHAR sex,
NUMERIC salary,
cod_supervisor INTEGER NOT NULL,
nro_depto INTEGER NOT NULL,
PRIMARY KEY (code_emp),
FOREIGN KEY (cod_supervisor) REFERENCES EMPLOYEE(cod_emp) ON DELETE CASCADE,
FOREIGN KEY (dept_nro) REFERENCES DEPARTMENT(dept_nro) ON DELETE CASCADE
);

/* INSERTING DATA INTO TABLES */
INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (1, 'Roadrunner');

INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (2, 'Sylvester');

INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (3, 'Tweety Bird');

/* INSERTING DATA INTO TABLES */
INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (1, 'Roadrunner');

INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (2, 'Sylvester');

INSERT INTO DEPARTMENT(dept_number, dept_name) VALUES (3, 'Piu Piu');

INSERT INTO EMPLOYEE (employee_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, dept_number) VALUES (1, 'Carla', 'Perez', '12-12-1988', 'Street X, 123', 'F', 20000.50, 1, 1);

INSERT INTO EMPLOYEE (emp_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, department_number) VALUES (2, 'Carlos', 'Magno', '12-05-1978', 'Street X, 200', 'M', 1500, 1, 1);

INSERT INTO EMPLOYEE (emp_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, department_number) VALUES (3, 'João', 'Silva', '07/02/1990', 'Street Y, 200', 'M', 2730.83, 1, 2);
INSERT INTO EMPLOYEE (emp_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, department_number) VALUES (4, 'Manu', 'Gomez', '05-12-1998', 'Street X, 100', 'F', 25000.50, 3, 2);

INSERT INTO EMPLOYEE (emp_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, department_number) VALUES (5, 'Miguel', 'Ruan', '01-12-2000', 'Street T, 200', 'M', 2500, 1, 3);
INSERT INTO EMPLOYEE (employee_code, first_name, last_name, birthday_date, employee_address, gender, salary, supervisor_code, department_number) VALUES (6, 'Joana', 'Souza', '07/04/1995', 'ASX Street, 1345', 'F', 3130, 3, 2);


In questa pagina del sito puoi guardare il video online PL-PgSQL (Lesson 9) - Arrays in PostgreSQL - Declaration, Assignment, and Examples della durata di ore minuti seconda in buona qualità , che l'utente ha caricato DesCOMPlica, Oliba! 11 gennaio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,491 volte e gli è piaciuto 118 spettatori. Buona visione!