DBMS FILE
DBMS FILE
TRUNCATE: Removes all rows from a table, resetting it to an empty state.
1. Selection
Selection involves retrieving specific rows from the table based on a condition.
2. Projection
Projection is used to retrieve specific columns from a table
3. Sorting
Sorting arranges the result set in a specific order, using ORDER BY.
6. Renaming Attributes
Use AS to rename columns in the output.
7. Computed attributes:
This will display the Name and their salary after applying a 10% bonus.
8. Complex Conditions with AND:
Combining % and _:
1. Simple Joins
Simple joins use conditions to relate columns from multiple tables. We use
aliases to make table references shorter.
1. IN and NOT IN
IN and NOT IN are used to check if a value exists in a set of values returned by a
subquery.
Example: IN (Retrieve employees who are assigned to a project.)
Example: NOT IN (Retrieve employees who are not assigned to any project.)
1. Union
The UNION operation combines rows from two tables, removing duplicates,
and returns all unique rows from both queries.
Let’s say we want a combined list of all unique departments and all unique
project names.
2. Difference
The EXCEPT (or MINUS in some SQL dialects) operation returns rows from the
first query that are not in the second query.
For example, if we want to find employees who are not assigned to any
project, we can use EXCEPT.
3. Intersection
The INTERSECT operation returns rows that are common to both tables.
For instance, we can find employees who are also assigned to at least one
project.
4. Division
The DIVISION operation is useful when you want to find entities related to all
entities in another set. This is often simulated using JOIN, GROUP BY, and
HAVING clauses in SQL.