SELECT
SELECT
AND
WHERE
OR
GROUP BY customer_id
Limit
Between
And
‘%’ for long sentence characters and ‘_’ allows us to replace just a single character
Section – 3
GROUP BY store_id
Section – 5
ON payment.customer_id = Customer.customer_id
ON customer.customer_id = payment.customer_id
SELECT film.film_id,title,inventory_id
from film
inventory.film_id = film.film_id
UNION –
Section - 7
SELECT TIMEOFDAY ()
SELECT CURRENT_DATE
SELECT CURRENT_TIME
https://www.postgresql.org/docs/12/functions-formatting.html
f1.film_id != f2.film_id
Unit – 8
Primary Key – Having unique value in every row and coloumns ( Golden Key)
last_login TIMESTAMP
)
Create data on Tables -
VALUES
Update data –
UPDATE account
Deleting data
RENAME TO new_info
Ques. We're running a promotion to reward our top five customers with coupons. What are the
customer IDs of the top five customers based off total expenditure or total spend?
GROUP BY customer_id
LIMIT 5
Ques We are launching a platinum service for our most loyal customers. We will assign platinum
status to customers that have had 40 or more transaction payments. What customer IDs are
eligible for platinum status?
GROUP BY customer_id
1. Return the customer IDs of customers who have spent at least $110 with the
staff member who has an ID of 2.
Sol. SELECT customer_id, sum(amount) from PAYMENT
WHERE staff_id = 2
GROUP BY customer_id
3. What customer has the highest customer ID number whose name starts with an 'E' and has an
address ID lower than 500?
LIMIT 1
Ques So let's imagine that a California sales tax law has changed, and we need to alert our
customers to this through email. So the question is, what are the emails of the customers who
live in California?
ON customer.address_id = address.address_id
Ques. A customer walks into the store and they're a huge fan of this actor, Nick Wahlberg, and
they want to know which movies has Nick Wahlberg been in. So your task is to basically get a
list of all the movies Nick Wahlberg has been in.So let's take a look at the expected results. Here
are the expected results. There should be 25 movies.
ON actor.actor_id = film_actor.actor_id
last_name = 'Wahlberg'
Assesment 2 -
https://docs.google.com/document/d/1wiuYbTQslmfolQWgeVPB356csjK6yqOUBhgC7fM44o8/edit
https://docs.google.com/document/d/
1swGZ0RG3KKqWqzmsI_qrMgjJ3lt39mtAJqRSMZy6Z-8/edit?usp=sharing
4, 11