Created
December 2, 2023 07:58
-
-
Save mb6ockatf/f06c0effe7d28e01601febb4a94a9b97 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
-- JOIN | |
SELECT customer.first_name, customer.last_name, | |
time(rental.rental_date) as rental_time | |
FROM customer-- as c | |
INNER JOIN rental -- as r | |
ON customer.customer_id = rental.customer_id -- USING customer_id | |
WHERE date(rental.rental_date) = "2005-06-14"; | |
-- TEMP TABLE | |
CREATE TEMPORARY TABLE actors_j | |
(actor_id smallint(5), | |
first_name varchar(45), | |
last_name varchar(45), | |
); | |
-- INCLUDE ANOTHER RESULT SET | |
SELECT concat(cust.last_name, ', ', cust.first_name) full_name | |
FROM ( | |
SELECT first_name, last_name, email | |
FROM customer | |
WHERE first_name = 'JESSIE' | |
) AS cust; | |
-- DELETE DUPLICATES | |
SELECT DISTINCT * FROM actors ORDER BY 1 asc; | |
-- DESC | |
SELECT * | |
FROM sqlite_master | |
WHERE type = 'table'; | |
-- 2 select statements can be treated like sets | |
-- select * from aboba | |
-- union all | |
-- select * from amogus; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment