Sample Exam Questions
For this table, what does the output look like when you run 'select a b from test;'?
a
---
a
a
---
b
b
---
a
※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/02
The most basic form of a SELECT statement is: SELECT column_name FROM table_name WHERE conditional_expression.
If you specify * for the column_name, you are specifying all columns in the table, and if you omit WHERE clause, all rows in the table are selected. This is the SELECT statement at the beginning of this question, and you can see that the table has two columns, a and b, and contains only one row of data, where the value in column a is a and the value in column b is b.
You can specify multiple column names separated by commas, but in this question the column_name is specified as "a b" with no commas. In fact, you can specify display names in column_name, in addition to the table column names and expressions. In this case, a is the column name, and b is the display name. Note that "a as b" has the same meaning. The display name appears as the column name in psql and other output, and is also used as the column name in a view.
In the SELECT statement of this question, the column name is displayed as b, but the displayed data is the value of the column a, which is a.
Therefore, the correct answer is C.
© EDUCO All Rights Reserved.