Which command is used to select distinct subject (SUB) from the table (BOOK)? A. SELECT ALL FROM BOOK B. SELECT DISTINCT SUB FROM BOOK C. SELECT SUB FROM BOOK D. All of the above E. None of the above

SELECT ALL FROM BOOK
SELECT DISTINCT SUB FROM BOOK
SELECT SUB FROM BOOK
All of the above E. None of the above

The correct answer is B. SELECT DISTINCT SUB FROM BOOK.

The SELECT statement is used to retrieve data from a table. The ALL keyword is used to select all rows from the table, while the DISTINCT keyword is used to select only unique rows. The SUB keyword is used to select the subject column from the table. Therefore, the SELECT DISTINCT SUB FROM BOOK statement will select all unique subjects from the BOOK table.

The SELECT ALL FROM BOOK statement will select all rows from the BOOK table, including duplicate rows. The SELECT SUB FROM BOOK statement will select all rows from the BOOK table, including duplicate rows, for the SUB column. Therefore, both of these statements are incorrect.

The answer E. None of the above is also incorrect, because the SELECT DISTINCT SUB FROM BOOK statement is a valid SQL statement that will select all unique subjects from the BOOK table.

Exit mobile version