Bird
0
0

Given the table Employees with columns id, name, and department, what will the following SQL return?

medium📝 query result Q4 of 15
SQL - Views
Given the table Employees with columns id, name, and department, what will the following SQL return?
CREATE VIEW ITStaff AS SELECT id, name FROM Employees WHERE department = 'IT';
SELECT * FROM ITStaff;
AAll employees showing id, name, and department
BAll employees with department 'IT' showing all columns
CAll employees with department 'IT' showing id and name
DSyntax error due to missing AS keyword
Step-by-Step Solution
Solution:
  1. Step 1: Understand the view definition

    The view ITStaff selects id and name from Employees where department is 'IT'.
  2. Step 2: Analyze the SELECT from the view

    Selecting from ITStaff returns only id and name columns for employees in the IT department.
  3. Final Answer:

    All employees with department 'IT' showing id and name -> Option C
  4. Quick Check:

    View filters rows and columns as defined [OK]
Quick Trick: View returns columns and rows as defined in its SELECT [OK]
Common Mistakes:
MISTAKES
  • Expecting all columns
  • Ignoring WHERE filter
  • Thinking AS keyword is missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes