0% found this document useful (0 votes)
6 views6 pages

MySQL Commands Presentation

This document provides an overview of essential MySQL commands including ORDER BY, INSERT INTO, UPDATE, NULL values, and DELETE, each with definitions, examples, and useful tips. Key functionalities include sorting query results, adding new rows, modifying existing records, handling NULL data, and removing rows based on conditions. The document emphasizes the importance of using clauses like WHERE and LIMIT to refine operations and avoid unintended consequences.

Uploaded by

Anjali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

MySQL Commands Presentation

This document provides an overview of essential MySQL commands including ORDER BY, INSERT INTO, UPDATE, NULL values, and DELETE, each with definitions, examples, and useful tips. Key functionalities include sorting query results, adding new rows, modifying existing records, handling NULL data, and removing rows based on conditions. The document emphasizes the importance of using clauses like WHERE and LIMIT to refine operations and avoid unintended consequences.

Uploaded by

Anjali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MySQL Commands Overview

 A quick guide on essential MySQL commands with


definitions, examples, and useful tips.
ORDER BY
 Definition: The ORDER BY clause is used to sort the
result set of a query in ascending (ASC) or descending
(DESC) order based on one or more columns.

 Example:
SELECT * FROM Employees
ORDER BY salary DESC, name ASC;

 Useful Tip: Use ORDER BY with LIMIT to fetch top or


bottom records, e.g., highest or lowest salaries.
INSERT INTO
 Definition: The INSERT INTO statement is used to add
new rows to a table. You can insert data into all
columns or specify only specific columns.

 Example:
INSERT INTO Employees (name, position, salary)
VALUES ('John Doe', 'Developer', 60000);

 Useful Tip: Use INSERT INTO ... SELECT to copy data


from one table to another.
UPDATE

 Definition: he UPDATE statement modifies existing


records in a table. It can be used to change data in one
or multiple columns for specific rows.

 Example:
UPDATE Employees
SET salary = 65000
WHERE name = 'John Doe';

 Useful Tip: Always use a WHERE clause to avoid


updating all rows unintentionally.
NULL Values
 Definition: NULL represents missing or unknown data
in a table. It’s different from an empty string or zero.

 Example:
SELECT * FROM Employees
WHERE manager_id IS NULL;

 Useful Tip: Use IS NULL and IS NOT NULL to filter for


NULL values, as = and != don’t work with NULL.
DELETE
 Definition: he DELETE statement removes rows from a
table based on a specified condition.

 Example:
DELETE FROM Employees
WHERE name = 'John Doe';

 Useful Tip: Use DELETE FROM table_name without


WHERE cautiously, as it will delete all records. To
empty a table without removing its structure, consider
using TRUNCATE TABLE table_name.

You might also like