This file contains hidden or 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
| SELECT COUNT(*) | |
| FROM film | |
| WHERE length > ( | |
| SELECT AVG(length) | |
| FROM film | |
| ); | |
| SELECT COUNT(*) | |
| FROM film | |
| WHERE rental_rate = ( | |
| SELECT MAX(rental_rate) |
This file contains hidden or 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. Tüm İsimleri Sıralama (UNION) - Birleşim Kümesi | |
| (SELECT first_name FROM actor) | |
| UNION | |
| (SELECT first_name FROM customer); | |
| -- 2. Kesişen İsimleri Sıralama (INTERSECT) - Kesişim Kümesi | |
| (SELECT first_name FROM actor) | |
| INTERSECT | |
| (SELECT first_name FROM customer); |
This file contains hidden or 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
| SELECT city.city, country.country | |
| FROM city | |
| LEFT JOIN country ON city.country_id = country.country_id; | |
| SELECT payment.payment_id, customer.first_name, customer.last_name | |
| FROM customer | |
| RIGHT JOIN payment ON customer.customer_id = payment.customer_id; | |
| SELECT rental.rental_id, customer.first_name, customer.last_name | |
| FROM customer | |
| FULL JOIN rental ON customer.customer_id = rental.customer_id; |
This file contains hidden or 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
| SELECT city.city, country.country | |
| FROM city | |
| INNER JOIN country ON city.country_id = country.country_id; | |
| SELECT payment.payment_id, customer.first_name, customer.last_name | |
| FROM customer | |
| INNER JOIN payment ON customer.customer_id = payment.customer_id; | |
| SELECT rental.rental_id, customer.first_name, customer.last_name | |
| FROM customer | |
| INNER JOIN rental ON customer.customer_id = rental.customer_id; |
This file contains hidden or 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
| CREATE TABLE employee ( | |
| id INTEGER, | |
| name VARCHAR(50), | |
| birthday DATE, | |
| email VARCHAR(100) | |
| );INSERT INTO employee (id, name, birthday, email) VALUES | |
| (1, 'Beitris', '1995-10-22', 'beitris0@google.cn'), | |
| (2, 'Adlai', '1990-05-15', 'adlai1@weather.com'), | |
| (3, 'Brander', '1988-11-30', 'brander2@zimbio.com'), | |
| (4, 'Skipper', '2000-02-14', 'skipper3@cbslocal.com'), |
This file contains hidden or 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
| SELECT rating, COUNT(*) FROM film | |
| GROUP BY rating; | |
| SELECT replacement_cost, COUNT(*) FROM film | |
| GROUP BY replacement_cost | |
| HAVING COUNT(*) > 50 | |
| ORDER BY replacement_cost; | |
| SELECT store_id, COUNT(*) FROM customer | |
| GROUP BY store_id; | |
| SELECT country_id, COUNT(*) FROM city | |
| GROUP BY country_id |
This file contains hidden or 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
| SELECT AVG(rental_rate) FROM film; | |
| SELECT COUNT(*) FROM film | |
| WHERE title LIKE 'C%'; | |
| SELECT MAX(length) FROM film | |
| WHERE rental_rate = 0.99; | |
| SELECT COUNT(DISTINCT replacement_cost) FROM film | |
| WHERE length > 150; |
This file contains hidden or 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
| SELECT * FROM film | |
| WHERE title LIKE '%n' | |
| ORDER BY length DESC | |
| LIMIT 5; | |
| SELECT * FROM film | |
| WHERE title LIKE '%n' | |
| ORDER BY length ASC | |
| OFFSET 5 LIMIT 5; | |
| SELECT * FROM customer | |
| WHERE store_id = 1 |
This file contains hidden or 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
| SELECT DISTINCT replacement_cost FROM film; | |
| SELECT COUNT(DISTINCT replacement_cost) FROM film; | |
| SELECT COUNT(*) FROM film | |
| WHERE title LIKE 'T%' AND rating = 'G'; | |
| SELECT COUNT(*) FROM country | |
| WHERE country LIKE '_____'; | |
| SELECT COUNT(*) FROM city | |
| WHERE city ILIKE '%r'; |
This file contains hidden or 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
| SELECT country FROM country | |
| WHERE country LIKE 'A%a'; | |
| SELECT country FROM country | |
| WHERE country LIKE '_____%n'; | |
| SELECT title FROM film | |
| WHERE title ILIKE '%t%t%t%t%'; | |
| SELECT * FROM film | |
| WHERE title LIKE 'C%' | |
| AND length > 90 | |
| AND rental_rate = 2.99; |
NewerOlder