※This sample exam is different from those that appear in the actual OSS-DB Exam.
2018/04/07
The basic syntax of the DELETE statement is below.
DELETE FROM table name ((AS) table alias) WHERE conditional expression Since FROM is mandatory, B becomes an error.
Unlike SELECT statements, you can not put more than one table in a comma-separated list in the FROM clause. Therefore C also causes an error.
T1.table1 t2 in the FROM clause of A means that the table named table1 in the schema t1 is to be deleted and t1.table1 is referred to by another name t2. a = b in the WHERE clause means that if the value of column a is equal to the value of column b, it is deleted. Therefore, if there exists a schema, table, and column of such a name and if a and b are comparable then it is not an error.
D has no WHERE clause, but in this case all rows of table1 are deleted. By executing from psql, you can not ROLLBACK by default, so be very careful.
E is a SELECT statement in the WHERE clause, but if the value of column a of table1 is included in the set of values returned by the SELECT statement in parentheses, those rows from table1 is deleted. Therefore, if columns a and x exist in table1 and table2, respectively, and if a and x can be compared, no error occurs.
It is a matter of choosing what is wrong, so the correct answer are B and C.