<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Blog de la clase by Vanesa Justicia Cifuentes</title>
      <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n</link>
      <description>Soluciones al examen</description>
      <language>en-us</language>
      <pubDate>2024-03-12 16:00:23 UTC</pubDate>
      <lastBuildDate>2024-04-08 22:33:38 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url>https://padlet.net/icons/png/1f4bb.png</url>
      </image>
      <item>
         <title>1. Indica el orden de creación de las tablas y explica por qué.</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2915901240</link>
         <description><![CDATA[<p>El orden de creación de tablas es cuando hay dependencias entre ellas, como claves foráneas. La tabla referenciada debe crearse antes de la tabla que contiene la clave foránea. Este orden asegura la integridad referencial y evita conflictos</p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/01d2e086f675863c085053f85d23b12b/1_bd.jpeg" />
         <pubDate>2024-03-12 16:20:58 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2915901240</guid>
      </item>
      <item>
         <title>2. Crea la tabla de empleados</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2915927830</link>
         <description><![CDATA[<p>Primero que las comas indica si es a nivel tabla o columna, ahora se tendría que ver así la creación de la tabla:</p><p>CREATE TABLE employees (</p><p>    EMPLOYEE_ID NUMBER(6) PRIMARY KEY,</p><p>    FIRST_NAME VARCHAR2(20),</p><p>    LAST_NAME VARCHAR2(25) NOT NULL,</p><p>    EMAIL VARCHAR2(25) NOT NULL,</p><p>    PHONE_NUMBER VARCHAR2(20),</p><p>    HIRE_DATE DATE DEFAULT SYSDATE NOT NULL,</p><p>    JOB_ID VARCHAR2(10),</p><p>    SALARY NUMBER(8,2),</p><p>    COMMISSION_PCT NUMBER(2,2),</p><p>    MANAGER_ID NUMBER(6) REFERENCES employees(EMPLOYEE_ID),</p><p>    DEPARTMENT_ID NUMBER(4),</p><p>    CONSTRAINT LAST_NAME_NN CHECK (LAST_NAME IS NOT NULL),</p><p>    CONSTRAINT EMAIL_NN CHECK (EMAIL IS NOT NULL),</p><p>    CONSTRAINT HIRE_DATE_NN CHECK (HIRE_DATE IS NOT NULL),</p><p>    CONSTRAINT FK_JOB_ID FOREIGN KEY (JOB_ID) REFERENCES job(JOB_ID)</p><p>);</p><p><br></p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/1575f94ccc0bfe331043ef1da4294b49/2_bd.jpeg" />
         <pubDate>2024-03-12 16:41:57 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2915927830</guid>
      </item>
      <item>
         <title>3. Insertar un empleado</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947303224</link>
         <description><![CDATA[<p>INSERT INTO employeer(employee_id, first_name. last_name, email, phone_number, hire_date, job_id, salary, commission_pct, manager_id, department_id)</p><p>VALUES (123123, 'Alex', 'Jimenez', '<a rel="noopener noreferrer nofollow" href="mailto:a.jimenez@gmail.com">a.jimenez@gmail.com</a>', '634634634', sysdate, '2323232323', 123,123.00, 12.32, 2342);</p><p><br></p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/b1cf450f78dc3ddedefd34eba58e2c71/3_.jpg" />
         <pubDate>2024-04-08 20:57:40 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947303224</guid>
      </item>
      <item>
         <title>4.Modifica el nombre del empleado 157</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947307341</link>
         <description><![CDATA[<p>No esta hecha, pero seria esta la solución:</p><p>UPDATE employees</p><p>SET first_name = 'Andres'</p><p>WHERE employee_id = 157;</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:03:00 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947307341</guid>
      </item>
      <item>
         <title>5. Crea la copia de la tabla de empleados y que tenga en esa copia un tipo de trabajo que empiece por AD</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947309925</link>
         <description><![CDATA[<p>La solución seria:</p><p>CREATE TABLE copy_emp_ad AS</p><p>SELECT *</p><p>FROM employees</p><p>WHERE job_id LIKE 'AD%';</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:07:06 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947309925</guid>
      </item>
      <item>
         <title>6. Añade la columna miembros a la tabla de departamentos</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947313105</link>
         <description><![CDATA[<p>La solución seria:</p><p>ALTER TABLE departments</p><p>ADD miembros INT;</p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/dca29a143220d077bf7e72c949274fa5/6_.jpg" />
         <pubDate>2024-04-08 21:11:33 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947313105</guid>
      </item>
      <item>
         <title>7. Elimina la restricciónes de NN al email de la tabla employees</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947314768</link>
         <description><![CDATA[<p>La solución seria:</p><p>ALTER TABLE employees</p><p>ALTER COLUMN email DROP NOT NULL;</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:13:53 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947314768</guid>
      </item>
      <item>
         <title>8. Añade la restricción de unicidad en el campo department_name</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947316498</link>
         <description><![CDATA[<p>La solución seria:</p><p>ALTER TABLE departments</p><p>ADD CONSTRAINT unique_department_name UNIQUE (department_name);</p><p><br></p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/52f30fed048f9af5ff20870ac7273698/8_.jpg" />
         <pubDate>2024-04-08 21:16:41 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947316498</guid>
      </item>
      <item>
         <title>9. Elimina a los empleados del departamento 20 y del departamento 50</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947317906</link>
         <description><![CDATA[<p>La solución seria:</p><p>DELETE FROM employees</p><p>WHERE department_id IN (20, 50);</p><p><br></p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/4fb0e312441d39c61c5f6b193dcba412/9_.jpg" />
         <pubDate>2024-04-08 21:18:43 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947317906</guid>
      </item>
      <item>
         <title>13. Muestra los empleados que contengan en su nombre, la letra que introduzca el usuario por pantalla </title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947322235</link>
         <description><![CDATA[<p>La solución seria:</p><p>SELECT *</p><p>FROM employees</p><p>WHERE first_name LIKE '%' || '&amp;letra' || '%';</p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/273cec74e0ad50069a7b0d8268b77e83/13_.jpg" />
         <pubDate>2024-04-08 21:25:14 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947322235</guid>
      </item>
      <item>
         <title>14. Mostrar los diferentes tipos de trabajos en la tabla employees</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947323655</link>
         <description><![CDATA[<p>DESCRIBE employees;</p><p>SELECT DISTINCT job_title</p><p>FROM employees;</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:27:39 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947323655</guid>
      </item>
      <item>
         <title>15. Muestra el salario anual de los empleados. Se mostrará la divisa local, ya que esta consulta se va a realizar en diferentes países.</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947331931</link>
         <description><![CDATA[<p>No he podido hacerla con el cambio de divisas</p><p>La solución parcial seria:</p><p>SELECT </p><p>    employee_id,</p><p>    first_name,</p><p>    last_name,</p><p>    salary * 12 AS annual_salary</p><p>FROM </p><p>    employees;</p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/1ee34e36c6b9da675418747ad7e321e2/15_.jpg" />
         <pubDate>2024-04-08 21:42:01 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947331931</guid>
      </item>
      <item>
         <title>16. Muestra los empleados del departamento 50 que han sido contratados un martes y que tengan un salario inferior a 8000. Ordénalo por el salario.</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947337985</link>
         <description><![CDATA[<p>La solución seria:</p><p>SELECT *</p><p>FROM employees</p><p>WHERE department_id = 50</p><p>AND TO_CHAR(hire_date, 'DAY') = 'TUESDAY'</p><p>AND salary &lt; 8000</p><p>ORDER BY salary;</p>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/2142428511/b3db865bfdf89c209df2d1e52c9eae27/16_.jpg" />
         <pubDate>2024-04-08 21:52:53 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947337985</guid>
      </item>
      <item>
         <title>17.  Calcula el salario mensual y el anual, teniendo en cuenta la comisión. Ordena por departamento y después por salario.</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947340019</link>
         <description><![CDATA[<p>La solución seria:</p><p>SELECT </p><p>    employee_id,</p><p>    first_name,</p><p>    last_name,</p><p>    salary + NVL(commission_pct * salary, 0) AS monthly_salary,</p><p>    (salary + NVL(commission_pct <em> salary, 0)) </em> 12 AS annual_salary,</p><p>    department_id</p><p>FROM </p><p>    employees</p><p>ORDER BY </p><p>    department_id, monthly_salary;</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:56:34 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947340019</guid>
      </item>
      <item>
         <title>18. Calcula los meses que llevan contratados los trabajadores cuyo job_id contenga la letra m en cualquier posición. Redondea los meses</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947340920</link>
         <description><![CDATA[<p>La solución seria:</p><p>SELECT </p><p>    employee_id,</p><p>    first_name,</p><p>    last_name,</p><p>    ROUND(MONTHS_BETWEEN(SYSDATE, hire_date)) AS meses_contratado</p><p>FROM </p><p>    employees</p><p>WHERE </p><p>    UPPER(job_id) LIKE '%M%';</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 21:58:29 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947340920</guid>
      </item>
      <item>
         <title>19. Muestra  los empleados y su login de usuario, que estará formado por la primera letra de su nombre y las cuatro primeras letras de apellido. Ordénalo por nombre de usuarios</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947349425</link>
         <description><![CDATA[]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 22:16:41 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947349425</guid>
      </item>
      <item>
         <title>20. Muestra la fecha de renovación del contrato de los empleados con id. La fecha sera 6 meses después de contratación. También se calculará una fecha de aviso 15 días antes de la fecha de renovación</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947355675</link>
         <description><![CDATA[<p>La solución es:</p><p>SELECT </p><p>    employee_id,</p><p>    hire_date,</p><p>    ADD_MONTHS(hire_date, 6) AS fecha_renovacion,</p><p>    ADD_MONTHS(hire_date, 6) - INTERVAL '15' DAY AS fecha_aviso_renovacion</p><p>FROM </p><p>    employees;</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 22:26:56 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947355675</guid>
      </item>
      <item>
         <title>21. Muestra los empleados que no tienen departamento.</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947356441</link>
         <description><![CDATA[<p>La solución es:</p><p>SELECT </p><p>    e.employee_id,</p><p>    e.first_name,</p><p>    e.last_name,</p><p>    'No tiene departamento' AS departamento</p><p>FROM </p><p>    employees e</p><p>LEFT JOIN </p><p>    departments d ON e.department_id = d.department_id</p><p>WHERE </p><p>    d.department_id IS NULL;</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 22:28:42 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947356441</guid>
      </item>
      <item>
         <title>22. Muestra los empleados que contienen en su apellido el texto que introduce el usuario por pantalla</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947358295</link>
         <description><![CDATA[<p>La solución es:</p><p>ACCEPT texto_apellido CHAR PROMPT 'Introduce el texto del apellido: '</p><p>SELECT *</p><p>FROM employees</p><p>WHERE UPPER(last_name) LIKE '%' || UPPER('&amp;texto_apellido') || '%';</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 22:32:15 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947358295</guid>
      </item>
      <item>
         <title>23. Muestra los empleados que tienen un salario mayor a 8000 y han sido contratados un día 17 o un 24</title>
         <author>vanesajusticia32</author>
         <link>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947358882</link>
         <description><![CDATA[<p>La solución seria:</p><p>SELECT *</p><p>FROM employees</p><p>WHERE salary &gt; 8000</p><p>AND (EXTRACT(DAY FROM hire_date) = 17 OR EXTRACT(DAY FROM hire_date) = 24);</p>]]></description>
         <enclosure url="" />
         <pubDate>2024-04-08 22:33:38 UTC</pubDate>
         <guid>https://padlet.com/vanesajusticia32/rtyuh3lnh27ymn6n/wish/2947358882</guid>
      </item>
   </channel>
</rss>
