White Lightning
White Lightning
White Lightning

Select all data from a table

SELECT * FROM customers;

White Lightning

Select specific columns from a table

SELECT name, email FROM customers;

White Lightning

Select data from a table with conditions

SELECT * FROM customers WHERE country = 'United States';

White Lightning

Order data by a column

SELECT * FROM customers ORDER BY name ASC;

White Lightning

Order data by a column

SELECT country, COUNT(*) AS count FROM customers GROUP BY country;

White Lightning

Aggregate functions:SUM, AVG, and COUNT

SELECT SUM(total_spent) AS total_revenue FROM orders;

White Lightning

Join two tables

SELECT customers.name, orders.total_spent FROM customers INNER JOIN orders ON customers.id = orders.customer_id;

White Lightning

Update data in a table

UPDATE customers SET email = 'new_email@example.com' WHERE id = 1;

White Lightning

Delete data from a table

DELETE FROM customers WHERE id = 1;

White Lightning

Create a new table

CREATE TABLE products (    id INT NOT NULL AUTO_INCREMENT,    name VARCHAR(255) NOT NULL,    price DECIMAL(10,2) NOT NULL,    PRIMARY KEY (id) );