Which query correctly retrieves unique combinations of two columns from a table?

Get ready for the SAS Advanced Programming Certification Exam. Use multiple choice questions and flashcards, with detailed explanations. Ensure success in your exam and enhance your SAS skills!

The query that retrieves unique combinations of two columns from a table is the one that uses the DISTINCT keyword correctly in conjunction with both columns specified in the SELECT statement. In this scenario, option A is correct because it correctly employs the DISTINCT keyword to ensure that the results only include unique pairs of values from the Customer_Type_ID and Country columns.

When the DISTINCT keyword is used in the context of multiple columns, it considers the combination of all specified columns, filtering out any duplicate rows that would have the same values across both columns. This results in a list of unique combinations.

The other options fall short for a variety of reasons. For instance, option B lacks a comma between the column names, which would result in a syntax error. This means the query would not execute successfully, thereby failing to return any results. Option C incorrectly places the DISTINCT keyword before just one of the columns, which is not valid SQL syntax and cannot achieve the intended purpose of obtaining unique combinations. Lastly, option D attempts to use the DISTINCT keyword in a WHERE clause, which is not the correct application of DISTINCT, as it should be used directly in the SELECT statement to filter the output.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy