WARNING:
JavaScript is turned OFF. None of the links on this concept map will
work until it is reactivated.
If you need help turning JavaScript On, click here.
Este Cmap, tiene información relacionada con: JOINnSUBqueries.cmap, SUBQUERIES data modification INSERT, QUERIES ¿? SUBQUERIES, SUBQUERIES how to use it You can do subqueries in three diferent places, UPDATE table SET column_name = value, ... [WHERE [SUBQUERY] ...]; example Update 2 columns we can do: UPDATE film SET replacement_cost = (SELECT AVG(replacement_cost) FROM film), rental_cost = (SELECT AVG(replacement_cost)*0,1 FROM film) WHERE replacement_cost ᡌ, we want to insert the data of all the customers that are inactive as Actors INSERT INTO actor (first_name,last_name) SELECT first_name,last_name FROM customer WHERE active=0; example INSERT, INTERVAL () Return the index of the argument that is less than the first argument example SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);, Returns pairs of rows with common values for identitically named columns (all) and without duplicating columns example SELECT * FROM Table A NATURAL JOIN Table B, You can do subqueries in three diferent places In the SELECT, You can do subqueries in three diferent places In the WHERE, NOT IN Example SELECT * FROM Employee WHERE Name NOT IN(SELECT Manager FROM Employee), ANY definition val = ANY (set) is true if there is at least one member of the set equal to the value, QUERIES ???? JOIN, ALL definition val = ALL (set) is true if all members of the set are equal to the value, JOIN types NATURAL JOIN, Do not depend on data from the outer query Execute only once for all the rows processed in the entire outer query Example SELECT employee_number, name FROM employee AS e1 WHERE salary > (SELECT avg(salary) FROM employee WHERE department = e1.department);, Is not very usefull or common to use it application SELECT, WHERE ways Correlated / Not Correlated, SELECT employee_number, name FROM employee AS e1 WHERE salary > (SELECT avg(salary) FROM employee WHERE department = e1.department); explanation The inner query has to be executed for every employee as the department will change for every row. Hence the average salary will also change., JOIN types INNER, DELETE example to delete al students who have failed the subject IAI: DELETE FROM student WHERE id IN ( SELECT id FROM grade WHERE code = 'IAI' AND Markអ );