Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Scripts-SQL-teoria/tests.sql
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (35 sloc)
1.63 KB
This file contains 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
/* PRUEBAS */ | |
/* Para la correcta realización de estas pruebas, la base de datos debe estar inicialmente vacía (sin datos) */ | |
CALL pInsertDepartment('Economía', 'Almeria'); | |
/* Insertar departamento duplicado: descomentar la siguiente línea */ | |
/* CALL pInsertDepartment ('Economía', 'Almeria'); */ | |
CALL pInsertEmployee(1, NULL, 'Daniel', 500, '2019-09-15', '2020-09-15', 0.2); | |
CALL pInsertEmployee(1, NULL, 'Elena', 1500, '2019-09-15', '2020-09-15', 0.2); | |
CALL pInsertEmployee(1, NULL, 'Florian', 5000, '2019-09-15', '2020-09-15', 0.2); | |
CALL pInsertEmployee(1, NULL, 'Gema', 7500, '2019-09-15', '2020-09-15', 0.2); | |
CALL pInsertEmployee(1, NULL, 'Helena', 5100, '2019-09-15', '2020-09-15', 0.2); | |
SELECT * FROM Employees; | |
/* Procedimiento para igualar comisiones: ejecutar las siguientes líneas una por una observando el resultado */ | |
SELECT employeeId, fee FROM Employees; | |
CALL pEquateFees(); | |
SELECT employeeId, fee FROM Employees; | |
/* Procedimiento pSubirComisionEmpleado: ejecutar las siguientes líneas una por una observando el resultado */ | |
SELECT fee FROM Employees WHERE employeeId = 1; | |
CALL pRaiseFee(1, 0.1); | |
SELECT fee FROM Employees WHERE employeeId = 1; | |
/* Si usamos la función de agregación COUNT, se cuentan los NULL */ | |
SELECT city, COUNT(*) | |
FROM Departments | |
GROUP BY city; | |
/* Si usamos la función que acabamos de definir, no se cuentan los NULL */ | |
SELECT city, fNumEmployees(city) | |
FROM Departments | |
GROUP BY city; | |
/* Trigger tEmpleadoPropioJefeU */ | |
UPDATE Employees SET bossId=5 | |
WHERE employeeId = 5; | |
/* Trigger tCambiosComision */ | |
UPDATE Employees SET fee=0.9 | |
WHERE employeeId = 5; | |
/* Función fSumaSalarios */ | |
SELECT fSumSalaries(); |