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

Publicado el: 11 enero 2021
en el canal de: 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);


En esta página del sitio puede ver el video en línea PL-PgSQL (Lesson 9) - Arrays in PostgreSQL - Declaration, Assignment, and Examples de Duración hora minuto segunda en buena calidad , que subió el usuario DesCOMPlica, Oliba! 11 enero 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,491 veces y le gustó 118 a los espectadores. Disfruta viendo!