0% found this document useful (0 votes)
1 views1 page

SQL notes

The document outlines various SQL commands and their functionalities, including SELECT, INSERT, UPDATE, DELETE, and aggregate functions like MIN, MAX, AVG, and SUM. It explains the use of conditions in queries, such as WHERE, LIKE, and BETWEEN, as well as the ability to handle NULL values and distinct records. Additionally, it covers the syntax for managing tables, including dropping tables and inserting multiple rows.

Uploaded by

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

SQL notes

The document outlines various SQL commands and their functionalities, including SELECT, INSERT, UPDATE, DELETE, and aggregate functions like MIN, MAX, AVG, and SUM. It explains the use of conditions in queries, such as WHERE, LIKE, and BETWEEN, as well as the ability to handle NULL values and distinct records. Additionally, it covers the syntax for managing tables, including dropping tables and inserting multiple rows.

Uploaded by

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

1.

SELECT *
FROM
WHERE (=, >, <, >=, <=, <>, BETWEEN, LIKE, IN)
2. SELECT DISTINCT No duplicate
3. SELECT COUNT (DISTINCT column_name)
 SELECT Count(*) AS xxx Workaround for MS Access
 FROM (SELECT DISTINCT column_name FROM Customers)
4. ORDER BY column1, column2, … ASC/DESC
5. WHERE NOT
6. WHERE column_name NOT LIKE ‘A%’ does not start with the letter 'A'
7. NOT BETWEEN, NOT IN
8. INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
Don’t need to specify column names if add values for all the columns of
the table. It is also possible to insert multiple rows in one statement,
separate each set of values with bracket and comma.
9. IS NULL/ IS NOT NULL Cannot use operators to compare
10. UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition
If you omit the WHERE clause, all records in the table will be updated.
11. DELETE FROM table_name WHERE condition
If you omit the WHERE clause, all records in the table will be deleted.
12. DROP TABLE Delete table completely
13. SELECT TOP / SELECT TOP xx PERCENT MySQL use LIMIT
14. MIN() / MAX() / AVG() / SUM()
15. LIKE % % = any number of characters, even zero characters;
LIKE end% = starts with;
LIKE %end = ends with;
16. BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'
17. CONCAT Link columns together
18.

You might also like