0
0
DBMS Theoryknowledge~10 mins

Projection operation in DBMS Theory - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Projection operation
Start with a Table
Select Columns to Keep
Remove Other Columns
Create New Table with Selected Columns
Result: Table with Only Chosen Columns
Projection operation takes a table and creates a new table with only the selected columns, removing all others.
Execution Sample
DBMS Theory
Table: Students(ID, Name, Age, Grade)
Projection: Select columns Name, Grade
Result: Table with columns Name, Grade only
This operation extracts only the Name and Grade columns from the Students table.
Analysis Table
StepInput Table ColumnsColumns SelectedActionOutput Table Columns
1ID, Name, Age, GradeName, GradeIdentify columns to keepName, Grade
2ID, Name, Age, GradeName, GradeRemove columns ID, AgeName, Grade
3N/AN/ACreate new table with selected columnsName, Grade
💡 Projection complete: only selected columns remain in the output table.
State Tracker
VariableStartAfter Step 1After Step 2Final
Input Table ColumnsID, Name, Age, GradeID, Name, Age, GradeID, Name, Age, GradeN/A
Selected ColumnsN/AName, GradeName, GradeName, Grade
Output Table ColumnsN/AN/AN/AName, Grade
Key Insights - 2 Insights
Why do we remove columns instead of just copying the whole table?
Because projection only keeps the selected columns, removing others to focus on needed data, as shown in execution_table rows 2 and 3.
Does projection change the number of rows in the table?
No, projection keeps all rows but only changes which columns are shown, as seen in the output table columns staying the same in number of rows.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what columns remain after Step 2?
AID, Name, Age, Grade
BID, Age
CName, Grade
DNo columns remain
💡 Hint
Check the 'Output Table Columns' column in row for Step 2 in execution_table.
At which step is the new table with only selected columns created?
AStep 3
BStep 2
CStep 1
DProjection does not create a new table
💡 Hint
Look at the 'Action' column in execution_table to find when the new table is created.
If we select columns ID and Age instead, what would be the output columns after Step 3?
AName, Grade
BID, Age
CID, Name, Age, Grade
DNo columns
💡 Hint
Refer to variable_tracker for how selected columns affect output columns.
Concept Snapshot
Projection operation:
- Select specific columns from a table
- Remove all other columns
- Keep all rows unchanged
- Result is a new table with only chosen columns
- Used to focus on needed data fields
Full Transcript
Projection operation in databases means selecting certain columns from a table and creating a new table with only those columns. The process starts with the original table, then identifies which columns to keep, removes the rest, and finally outputs a new table with only the selected columns. The number of rows stays the same, only columns change. This helps focus on relevant data without altering the original table structure.