SELECT
: Retrieves data from a table.
SELECT * FROM customers;
WHERE
: Filters rows based on conditions.
SELECT * FROM orders WHERE total_amount > 100;
ORDER BY
: Sorts the result set.
SELECT * FROM products ORDER BY price DESC;
LIMIT
: Limits the number of rows returned.
SELECT * FROM employees LIMIT 10;
INSERT INTO
: Inserts new rows of data.
INSERT INTO products (name, price) VALUES ('Laptop', 999.99);
UPDATE
: Modifies existing data.
UPDATE customers SET email = 'newemail@example.com' WHERE id = 1;
DELETE FROM
: Deletes rows from a table.
DELETE FROM orders WHERE id = 100;
CREATE TABLE
: Creates a new table.
CREATE TABLE employees ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), age INT );
ALTER TABLE
: Modifies an existing table.
ALTER TABLE customers ADD COLUMN address VARCHAR(100);
DROP TABLE
: Deletes a table.
DROP TABLE IF EXISTS orders;
GRANT
: Grants privileges to a user.
GRANT SELECT, INSERT ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password';
REVOKE
: Revokes privileges from a user.
REVOKE INSERT ON database.* FROM 'user'@'localhost';
START TRANSACTION
: Starts a new transaction.
START TRANSACTION;
COMMIT
: Saves the changes made by a transaction.
COMMIT;
ROLLBACK
: Discards the changes made by a transaction.
ROLLBACK;
These are basic examples of SQL commands and statements in MySQL. Depending on the complexity of your database and specific requirements, you may need to use more advanced SQL features and constructs.