1/7
Looks like no tags are added yet.
SELECT
Use Case: Retrieves specified columns or expressions from one or more database tables.
Syntax:SELECT column1, column2 FROM table_name;
GROUP BY
Use Case: Groups rows that have identical values in specified columns into summary rows, often used with aggregate functions.
Syntax:SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name;
COUNT
Use Case: Returns the number of rows or non-null column values matching specified criteria.
Syntax:SELECT COUNT(column_name) FROM table_name;
ORDER BY
Use Case: Sorts the query results in ascending (ASC) or descending (DESC) order based on one or more columns.
Syntax:SELECT column1, column2 FROM table_name ORDER BY column1 ASC|DESC;
UNION
Use Case: Combines the distinct result sets of two or more SELECT statements into a single result set.
Syntax:SELECT column1 FROM table1 UNION SELECT column1 FROM table2;
CASE WHEN
Use Case: Applies conditional logic within a query to return specific values based on defined conditions.
Syntax:SELECT column1, CASE WHEN condition1 THEN result1 ELSE result2 END FROM table_name;
DROP
Use Case: Permanently deletes an existing database object, such as a table or index, along with all its data.
Syntax:DROP TABLE table_name;
ALTER
Use Case: Modifies the structural definition of an existing database table, such as adding, deleting, or altering columns.
Syntax:ALTER TABLE table_name ADD column_name datatype;