Created
October 4, 2013 09:50
-
-
Save Shiti/6823577 to your computer and use it in GitHub Desktop.
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
1.EXPLAIN SELECT | |
f.title, a.first_name,a.last_name | |
FROM | |
film f | |
JOIN | |
film_actor fa USING (film_id) | |
JOIN | |
actor a USING (actor_id); | |
2.EXPLAIN SELECT | |
CONCAT(c.first_name, c.last_name) AS name, addr.address | |
FROM | |
customer c, | |
(SELECT | |
a.address, a.address_id | |
FROM | |
address a | |
WHERE | |
a.city_id IN (SELECT | |
c.city_id | |
FROM | |
city c, country cc | |
WHERE | |
c.country_id = cc.country_id | |
AND cc.country = 'Cameroon')) addr | |
WHERE | |
c.address_id = addr.address_id; | |
4.EXPLAIN SELECT | |
film_id, actor_id | |
FROM | |
sakila.film_actor | |
WHERE | |
actor_id = 1 | |
UNION ALL SELECT | |
film_id, actor_id | |
FROM | |
sakila.film_actor | |
WHERE | |
film_id = 1 AND actor_id <> 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment