This document contains solutions to SQL exercises for a class on databases. It includes 13 SQL queries with answers:
1) Selects all names from the TEMPLE table ordered by name
2) Selects a name from TEMPLE where number is 121
3) Selects all columns from TEMPLE where number is 121
4) Selects names and salaries from TEMPLE where number is less than 3 ordered by name
5) Selects department names from TDEPTO where budget is 20000 ordered by name
This document contains solutions to SQL exercises for a class on databases. It includes 13 SQL queries with answers:
1) Selects all names from the TEMPLE table ordered by name
2) Selects a name from TEMPLE where number is 121
3) Selects all columns from TEMPLE where number is 121
4) Selects names and salaries from TEMPLE where number is less than 3 ordered by name
5) Selects department names from TDEPTO where budget is 20000 ordered by name
This document contains solutions to SQL exercises for a class on databases. It includes 13 SQL queries with answers:
1) Selects all names from the TEMPLE table ordered by name
2) Selects a name from TEMPLE where number is 121
3) Selects all columns from TEMPLE where number is 121
4) Selects names and salaries from TEMPLE where number is less than 3 ordered by name
5) Selects department names from TDEPTO where budget is 20000 ordered by name
ESCUELA DE INGENIERA ELECTRNICA EN TELECOMUNICACIONES Y REDES
NOMBRE: MARCO LEMA PARALELO: CUARTO A CDIGO: 509 SOLUCIONES A LOS EJERCICIOS PLANTEADOS EN SQL. 1. SELECT NOMEM FROM TEMPLE ORDER BY 1;
2. SELECT NOMEM FROM TEMPLE WHERE NUMDE =121;
3. SELECT * FROM TEMPLE WHERE NUMDE = 121;
4. SELECT NOMEM , SALAR FROM TEMPLE WHERE NUMHI <3 ORDER BY 1;
5. SELECT NOMDE FROM TDEPTO WHERE PRESU = 20000 ORDER BY 1;
6. SELECT COMIS FROM TEMPLE WHERE NUMDE =110;
7. SELECT NOMDE FROM TEMPLE WHERE DIREC = EN FUNCIONES ORBER BY 1;
8. SELECT EXTEL FROM TEMPLE ORDER BY 1;
9. SELECT NOMEM FROM TEMPLE WHERE COMIS >= (SALAR*0.5) ORDER BY 1;
10. SELECT NOMEM, (SALAR+COMIS+(50*NUMHI)) AS PAGA TOTAL FROM TEMPLE WHERE NUMHI >= 4 ORDER BY 1;
11. SELECT NOMEM, SALAR + COMIS AS TOTAL FROM TEMPLE WHERE NUMDE = 112 ORDER BY TOTAL DESC;
SELECT NOMEM, SALAR + COMIS AS TOTAL FROM TEMPLE WHERE NUMDE = 112 ORDER BY 1;
12. SELECT NOMEM, (SALAR*12) AS ANUAL, (((SALAR*12)*6)/100)+(SALAR*12) AS ANUAL1,(((SALAR*12)*12)/100)+(SALAR*12) AS ANUAL2,(((SALAR*12)*18)/100)+(SALAR*12) AS ANUAL3 FROM TEMPLE WHERE NUMHI >4 ORDER BY 1;
13. SELECT NUMEM, NOMEM, SALAR+COMIS AS TOTAL FROM TEMPLE WHERE (SALAR + COMIS) > 300 ORDER BY 1;