Document
Document
Types Of Databases:
1. Relational database (RDBMS)
2. Non-Relational database (DBMS)
Types of Joins:
INNER JOIN:
Returns only the rows that have matching values in both tables.
If there's no match, the row is excluded.
LEFT (OUTER) JOIN:
Returns all rows from the left table and the matching rows from the
right table.
If there's no match, NULL values are returned for columns from the
right table.
Returns all rows from the right table and the matching rows from the
left table.
If there's no match, NULL values are returned for columns from the
left table.
Returns all rows when there is a match in either the left or the right
table.
If there's no match, NULL values are returned for non-matching rows.
CROSS JOIN:
Returns the Cartesian product of the two tables, i.e., all combinations
of rows from both tables.
Does not require any condition to match rows.
SELF JOIN:
Function:
A function in SQL is a set of statements that perform a specific task and
return a value. It is used within queries to calculate or manipulate data.
Functions cannot modify data (like INSERT, UPDATE, or DELETE).
Stored Procedure:
Define Clause’s
WHERE:
The WHERE clause is used to filter records at the row level, before any grouping
or aggregation takes place. It allows you to specify conditions that must be met
for a row to be included in the result set. It can operate on individual column
values and supports logical operators like AND, OR, and NOT.
GROUP BY:
The GROUP BY clause groups rows that have the same values in specified
columns into summary rows. It is typically used with aggregate functions like
COUNT, SUM, AVG, etc., to perform calculations on each group of rows. It must
follow the FROM and WHERE clauses in the SQL query.
HAVING:
The HAVING clause is used to filter results after they have been grouped by
GROUP BY. Unlike WHERE, which filters rows before grouping, HAVING filters
groups based on aggregate values. It is useful for applying conditions to the
results of aggregation, such as filtering out groups that don't meet certain criteria.
ORDER BY:
The ORDER BY clause is used to sort the result set in either ascending (ASC) or
descending (DESC) order, based on one or more columns. It can sort data in
multiple ways, either alphabetically or numerically, and it is always applied at the
end of the query execution process, after grouping, filtering, and aggregation.
Types of Triggers:
1. BEFORE Trigger:
2. AFTER Trigger: