Free Data-Management-Foundations Exam Braindumps
WGU Data Management - Foundations Questions 21–25 (page: 6)

Updated On: 11-Feb-2026

Which command is used to filter group results generated by the GROUP BY clause?

  1. REPLACE
  2. HAVING
  3. WITH
  4. WHERE

Answer(s): B

Explanation:

The HAVING clause is used in SQL to filter grouped results generated by the GROUP BY clause. Unlike WHERE, which filters individual rows before grouping, HAVING filters after aggregation has been performed.

Example Usage:

sql

SELECT Department, AVG(Salary) AS AvgSalary

FROM Employees

GROUP BY Department

HAVING AVG(Salary) > 50000;

This query first groups employees by Department, calculates the average salary per department, and then filters only those departments where the average salary is greater than 50,000.

Why Other Options Are Incorrect:

Option A (REPLACE) (Incorrect): Used for string substitution, not filtering.

Option C (WITH) (Incorrect): Used in Common Table Expressions (CTEs), not for filtering.

Option D (WHERE) (Incorrect): Used for row-level filtering before aggregation, but it cannot be used on aggregate functions like SUM() or AVG().

Thus, HAVING is the correct answer for filtering after grouping.


Reference:

SQL Aggregation and Grouping.



Which expression can be used to create a temporary name for a table?

  1. HAVING
  2. NEW
  3. ALIAS
  4. UNION

Answer(s): C

Explanation:

An alias is used in SQL to give a temporary name to a table or column within a query. It makes queries more readable and helps in cases where a table needs to be referenced multiple times (e.g., in a self-join).

Example Usage:

sql

SELECT e.Name, d.DepartmentName

FROM Employees AS e

JOIN Departments AS d

ON e.DeptID = d.ID;

Here, Employees is aliased as e and Departments as d, making the query shorter and clearer.

Why Other Options Are Incorrect:

Option A (HAVING) (Incorrect): Used to filter grouped results, not create aliases.

Option B (NEW) (Incorrect): Not a valid SQL keyword for aliasing.

Option D (UNION) (Incorrect): Combines result sets but does not rename tables.

Thus, the correct answer is ALIAS, which allows for temporary naming of tables or columns.


Reference:

SQL Aliases and Temporary Naming.



Which type of join selects all the rows from both the left and right table, regardless of match?

  1. Full Join
  2. Outer Join
  3. Inner Join
  4. Cross Join

Answer(s): A

Explanation:

A Full Join (FULL OUTER JOIN) selects all records from both tables, filling in NULL values where there is no match. This ensures that no data is lost from either table.

Example Usage:

sql

SELECT Employees.Name, Departments.DepartmentName

FROM Employees

FULL OUTER JOIN Departments ON Employees.DeptID = Departments.ID;

This query retrieves all employees and all departments, even if an employee has no assigned department or a department has no employees.

Types of Joins:

FULL OUTER JOIN (Correct Answer) Includes all rows from both tables, filling missing values with NULL.

LEFT JOIN (Incorrect) Includes all rows from the left table and matching rows from the right table.

RIGHT JOIN (Incorrect) Includes all rows from the right table and matching rows from the left table.

CROSS JOIN (Incorrect) Produces a Cartesian product (each row from one table is combined with every row from another table).

Thus, the correct answer is FULL JOIN, which ensures that all rows from both tables appear in the result.


Reference:

SQL Join Types Explained.



Which function removes only the leading spaces from a string?

  1. LTRIM
  2. LEFT
  3. TRIM
  4. REPLACE

Answer(s): A

Explanation:

The LTRIM() function in SQL removes leading spaces (spaces at the beginning of a string) while keeping spaces at the end.

Example Usage:

sql

SELECT LTRIM(' Hello World') AS TrimmedText;

Output:

bash

'Hello World'

Why Other Options Are Incorrect:

Option B (LEFT) (Incorrect): Used for extracting a portion of a string. Example:

sql

SELECT LEFT('Hello World', 5); -- Output: 'Hello'

Option C (TRIM) (Incorrect): Removes both leading and trailing spaces, not just leading ones.
Example:

sql

SELECT TRIM(' Hello World '); -- Output: 'Hello World'

Option D (REPLACE) (Incorrect): Replaces occurrences of one substring with another but does not specifically remove spaces.

Thus, the correct answer is LTRIM(), which removes only leading spaces.


Reference:

SQL String Functions.



Which SQL command uses the correct syntax to add a new employee "John Doe" to the Employee table?

  1. INSERT Employee { "John Doe" };
  2. INSERT INTO Employee (Name) VALUES ("John Doe");
  3. INSERT INTO Employee ("John Doe");
  4. INSERT Employee (Name) Values ("John Doe");

Answer(s): B

Explanation:

The correct syntax for inserting a new row into a table follows this structure:

Standard SQL INSERT Syntax:

sql

INSERT INTO TableName (Column1, Column2, ...)

VALUES (Value1, Value2, ...);

For this scenario:

sql

INSERT INTO Employee (Name) VALUES ('John Doe');

Why Other Options Are Incorrect:

Option A (Incorrect): Uses incorrect syntax { ... }, which is not valid SQL syntax.

Option C (Incorrect): Does not specify the column name, which causes an error.

Option D (Incorrect): Misses the INTO keyword, which is required in standard SQL.

Thus, the correct syntax is Option B, ensuring a properly formatted insert statement.


Reference:

SQL INSERT Statement.



Viewing page 6 of 13
Viewing questions 26 - 30 out of 60 questions


Post your Comments and Discuss WGU Data-Management-Foundations exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!