SQL Cheat Sheet DATAwithBARAA
SQL Cheat Sheet DATAwithBARAA
SELECT
Retrieve all data and columns from customers
SELECT *
FROM customers
FILTERING DATA
WHERE
List only german customers AND
SELECT * Find all customers who come from Germany AND whose
FROM customers score is less than 400
WHERE customers = ‘Germany‘ SELECT *
FROM customers
WHERE country = ‘Germany‘
AND score <= 500
D A TA w it h B A R AA
SQL Cheat Sheet datawithbaraa.com
SQL Youtube Tutorials
COUNT()
Find the total number of customers CONCAT()
SELECT COUNT(*) AS total_customers
List all customer names, where the name is combination
FROM customers of first name and last name
SUM() SELECT
Find the total quantity of all orders CONCAT(first_name,‘-‘,lastname) AS
customer_name
SELECT SUM(quantity) AS sum_quantity
FROM customers
FROM orders
LOWER()
AVG() List the first name of all customers in lowercase
Find the average score of all customers
SELECT
SELECT AVG(score) AS avg_score
LOWER(first_name) AS low_first_name
FROM orders
FROM customers