Please enable JavaScript.
Coggle requires JavaScript to display documents.
SQL COURSE (SQL STATEMENTS (SELECT
SELECT * FROM table, DISTINCT
…
SQL COURSE
SQL STATEMENTS
-
DISTINCT
- SELECT DISTINCT(fisrt-name) FROM table
WHERE
- SELECT * FROM customer WHERE first_name = 'Lis
COUNT
- SELECT COUNT(*) FROM customer WHERE first_name = 'Lisa'
ORDER BY
- SELECT * FROM customer ORDER BY address_id ASC
LIMIT
- SELECT * FROM table LIMIT 10
WHERE / LIKE
- SELECT * FROM customer WHERE first_name LIKE 'M%'
WHERE / BETWEEN
- SELECT * FROM customer WHERE address_id BETWEEN 5 and 10
WHERE / IN
- SELECT * FROM rental WHERE customer_id IN (7,13,10)
MIN / MAX
- SELECT MIN(inventory_id) FROM rental
AVG
- SELECT AVG(inventory_id) FROM rental
SUM
- SELECT SUM(inventory_id) FROM rental
GROUP BY
- SELECT SUM(staff_id) FROM rental GROUP BY staff_id
HAVING
- SELECT rating, AVG(rental_rate) FROM film WHERE rating IN ('R', 'G', 'PG') GROUP BY rating HAVING AVG(rental_rate)<3;
AS
- SELECT rating AS blabla FROM film
INNER JOIN
- SELECT payment.customer_id, rental_id, customer.first_name FROM payment INNER JOIN customer ON customer.customer_id = payment.customer_id;
UNION
- SELECT FROM salesq1 UNION SELECT FROM salesq2
UNION ALL
- SELECT FROM salesq1 UNION ALL SELECT FROM salesq2
-
ADVANCED SQL STATEMENTS
-
-
-
SUBQUERY
- SELECT title, rental_rate FROM film WHERE rental_rate > (SELECT AVG(rental_rate) FROM film)
SELF JOIN
- SELECT a.first_name, a.last_name, b.first_name, b.last_name FROM customer AS a, customer AS b WHERE a.first_name = b.last_name