The Selection operation is a query that retrieves rows from a table that satisfy a specific condition. It filters data based on criteria.
Click to reveal answer
beginner
Which symbol is commonly used to represent the Selection operation in relational algebra?
The Selection operation is represented by the Greek letter sigma (σ) in relational algebra.
Click to reveal answer
intermediate
How does Selection differ from Projection in database operations?
Selection filters rows based on conditions, while Projection selects specific columns from a table.
Click to reveal answer
beginner
Give an example of a Selection operation condition.
An example condition: σ (age > 30) selects all rows where the age column is greater than 30.
Click to reveal answer
beginner
What is the result of a Selection operation?
The result is a subset of the original table containing only rows that meet the selection criteria, with all columns intact.
Click to reveal answer
What does the Selection operation do in a database?
AFilters rows based on a condition
BSelects specific columns
CJoins two tables
DDeletes rows from a table
✗ Incorrect
Selection filters rows that satisfy a given condition.
Which symbol represents the Selection operation in relational algebra?
Aσ (sigma)
B∪ (union)
Cπ (pi)
D× (cross product)
✗ Incorrect
Sigma (σ) is used for Selection; Pi (π) is for Projection.
If you want to get all employees with salary > 5000, which operation would you use?
AUnion
BProjection
CJoin
DSelection
✗ Incorrect
Selection filters rows based on conditions like salary > 5000.
What does Selection operation return?
ASubset of columns
BSubset of rows
CAll rows and columns
DEmpty table
✗ Incorrect
Selection returns rows that meet the condition, keeping all columns.
Which of these is NOT true about Selection operation?
AIt filters rows
BIt is represented by σ
CIt changes the number of columns
DIt uses conditions
✗ Incorrect
Selection does not change columns; it only filters rows.
Explain the Selection operation and how it is used in databases.
Think about how you pick certain records from a list based on a rule.
You got /4 concepts.
Describe the difference between Selection and Projection operations.
One picks rows, the other picks columns.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the SELECT operation with a WHERE clause in a database?
easy
A. To delete all rows from a table
B. To add new rows to a table
C. To change the structure of a table
D. To filter rows that meet a specific condition
Solution
Step 1: Understand the SELECT operation
The SELECT operation retrieves data from a table.
Step 2: Role of WHERE clause
The WHERE clause filters rows based on a condition, returning only matching rows.
Final Answer:
To filter rows that meet a specific condition -> Option D
Quick Check:
Selection with WHERE filters rows [OK]
Hint: WHERE clause filters rows based on condition [OK]
Common Mistakes:
Confusing SELECT with INSERT or DELETE
Thinking WHERE changes table structure
Assuming SELECT without WHERE deletes data
2. Which of the following is the correct syntax to select all columns from a table named Employees where the Age is greater than 30?
easy
A. SELECT * Employees WHERE Age > 30;
B. SELECT ALL FROM Employees WHERE Age > 30;
C. SELECT * FROM Employees WHERE Age > 30;
D. SELECT * FROM Employees AGE > 30;
Solution
Step 1: Check SELECT syntax
The correct syntax to select all columns is SELECT * FROM table_name.
Step 2: Verify WHERE clause usage
The WHERE clause must follow FROM and include a condition like Age > 30.
Final Answer:
SELECT * FROM Employees WHERE Age > 30; -> Option C
Quick Check:
Correct SELECT with WHERE syntax [OK]
Hint: Use SELECT * FROM table WHERE condition; [OK]
Common Mistakes:
Omitting FROM keyword
Using ALL instead of *
Placing condition outside WHERE
3. Consider the table Students with columns ID, Name, and Score. What will be the result of the query?
SELECT Name FROM Students WHERE Score >= 75;
medium
A. Names of students with scores 75 or more
B. Names of students with scores less than 75
C. All columns of students with scores 75 or more
D. Error due to missing columns
Solution
Step 1: Analyze SELECT clause
The query selects only the Name column from Students.
Step 2: Analyze WHERE condition
WHERE Score >= 75 filters students with scores 75 or higher.
Final Answer:
Names of students with scores 75 or more -> Option A
Quick Check:
WHERE filters Score >= 75, SELECT Name only [OK]
Hint: WHERE filters rows; SELECT chooses columns [OK]
Common Mistakes:
Thinking it selects all columns
Confusing >= with >
Assuming it returns scores too
4. Identify the error in the following SQL query:
SELECT * FROM Orders WHERE OrderDate = '2023-13-01';
medium
A. Table name Orders is incorrect
B. Invalid date format in WHERE clause
C. SELECT * is not allowed
D. Missing semicolon at end
Solution
Step 1: Check date format in WHERE clause
The date '2023-13-01' has month 13, which is invalid.
Step 2: Verify other syntax parts
SELECT * FROM Orders; and semicolon are correct; table name assumed valid.
Final Answer:
Invalid date format in WHERE clause -> Option B
Quick Check:
Date month must be 1-12 [OK]
Hint: Check date values carefully in WHERE clause [OK]
Common Mistakes:
Ignoring invalid month number
Thinking missing semicolon causes error
Assuming SELECT * is wrong
5. You have a table Products with columns ProductID, Name, and Price. How would you write a query to select only products priced between 50 and 100 inclusive?
hard
A. SELECT * FROM Products WHERE Price >= 50 AND Price <= 100;
B. SELECT * FROM Products WHERE Price > 50 AND Price < 100;
C. SELECT * FROM Products WHERE Price >= 50 OR Price <= 100;
D. SELECT * FROM Products WHERE Price = 50 OR Price = 100;
Solution
Step 1: Understand inclusive range selection
Inclusive means including 50 and 100, so use >= and <= operators.
Step 2: Construct the WHERE clause
Use Price >= 50 AND Price <= 100 to filter the range correctly.
Step 3: Compare options
The query with > 50 AND < 100 excludes boundaries; the one with = 50 OR = 100 selects only extremes; the one with >= 50 OR <= 100 selects all rows.
Final Answer:
SELECT * FROM Products WHERE Price >= 50 AND Price <= 100; -> Option A
Quick Check:
Inclusive range uses >= and <= [OK]
Hint: Use >= and <= for inclusive range [OK]
Common Mistakes:
Using > and < excludes boundary values
Using OR instead of AND for range
Using OR with inequalities selects all rows
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.