Get unique values from a table column

This stored procedure will take in a table name and column name as input, and return all the unique values in that column as output.

Problem

Write a stored procedure that will take in a table name and column name as input, and return all the unique values in that column as output.
Example input:
Table name: "Employees"
Column name: "Department"
Example output:
"Sales"
"Marketing"
"IT"
"HR"

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
CREATE PROCEDURE get_unique_values(@table_name VARCHAR(50), @column_name VARCHAR(50))
AS
BEGIN
	SELECT DISTINCT @column_name FROM @table_name
END

/*

The solution above is optimal because it uses the DISTINCT keyword to return only unique values.

*/

A.I. Evaluation of the Solution

The solution above is optimal because it uses the DISTINCT keyword to return only unique values.

Evaluated at: 2023-01-30 02:15:33