exam questions

Exam 1z0-082 All Questions

View all questions & answers for the 1z0-082 exam

Exam 1z0-082 topic 1 question 88 discussion

Actual exam question from Oracle's 1z0-082
Question #: 88
Topic #: 1
[All 1z0-082 Questions]

Which three statements are true about views in an Oracle database? (Choose three.)

  • A. Views can be updated without the need to re-grant privileges on the view
  • B. Tables in the defining query of a view must always exist in order to create the view
  • C. The WITH CHECK clause prevents certain rows from being displayed when querying the view
  • D. Data Manipulation Language (DML) can always be used on views
  • E. Inserting one or more rows using a view whose defining query contains a GROUP BY clause will cause an error
  • F. Deleting one or more rows using a view whose defining query contains a GROUP BY clause will cause an error
  • G. The WITH CHECK clause prevents certain rows from being updated or inserted
Show Suggested Answer Hide Answer
Suggested Answer: AFG 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Rivaldo11
Highly Voted 3 years, 11 months ago
G is tricky answer - "The WITH CHECK clause prevents certain rows from being updated or inserted". Techically, it is correct, but I woulc rather say - "The WITH CHECK clause allow certain rows to be updated or inserted", since only rows which are inline with WITH CHECK constraint can be affected. Speaking about A - "...Specify OR REPLACE to re-create the view if it already exists. You can use this clause to change the definition of an existing view without dropping, re-creating, and regranting object privileges previously granted on it..." So, it should be A, E and F.
upvoted 9 times
Ekos
3 years, 7 months ago
hmm... make sense
upvoted 1 times
...
noobasty
2 years, 11 months ago
Answer is EFG A is wrong because it should be views can be altered*** without the need to re-grant privileges on the view. Not update G is correct, certain rows cannot be updated or inserted . for example. you try to update the department_id to 100 from 20 but the view was created with a where department id_= 20 or insert a deparment_id other than 20 . it will cause a ORA-01402 error
upvoted 9 times
shotcom
9 months, 3 weeks ago
answered G was not finished, certain rows cannot be updated or inserted, where? the correct form of the answer is "The WITH CHECK clause prevents certain rows from being updated or inserted in the underlying table through the view." which makes G wrong
upvoted 1 times
...
noobasty
2 years, 11 months ago
Answer is EFG A is wrong because it should be views can be replaced*** without the need to re-grant privileges on the view. Not update G is correct, certain rows cannot be updated or inserted . for example. you try to update the department_id to 100 from 20 but the view was created with a where department id_= 20 or insert a deparment_id other than 20 . it will cause a ORA-01402 error
upvoted 4 times
...
...
...
NowOrNever
Highly Voted 3 years, 11 months ago
Correct Answer: AEF Wrong Answer: BCD Uncertain: G https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_8004.htm#SQLRF01504 for me G could also be a valid answer
upvoted 5 times
...
it6567306
Most Recent 2 months, 1 week ago
Selected Answer: EFG
upvoted 1 times
...
it6567306
2 months, 1 week ago
The reason why option A is incorrect is due to the lack of the "OR REPLACE" clause. According to Oracle's official documentation, specifying "OR REPLACE" in the CREATE VIEW statement allows you to recreate an existing view and modify its definition without the need to drop, recreate, or regrant previously granted privileges on the view. For option A to be correct, it should state that by specifying "OR REPLACE," you can update a view without the need to regrant privileges on the view. https://docs.oracle.com/cd/F19136_01/sqlrf/CREATE-VIEW.html
upvoted 3 times
...
it6567306
2 months, 1 week ago
G is correct. CREATE TABLE employees ( employee_id NUMBER PRIMARY KEY, department_id NUMBER, salary NUMBER); INSERT INTO employees VALUES (1, 10, 5000); INSERT INTO employees VALUES (2, 10, 6000); INSERT INTO employees VALUES (3, 20, 7000); CREATE VIEW emp_view AS SELECT * FROM employees WHERE department_id = 10 WITH CHECK OPTION; UPDATE emp_view SET department_id = 20 WHERE employee_id = 1; ORA-01402: view WITH CHECK OPTION where-clause violation ORA-06512: at "SYS.DBMS_SQL", line 1721
upvoted 2 times
...
it6567306
2 months, 1 week ago
F is correct. CREATE TABLE employees ( employee_id NUMBER PRIMARY KEY, department_id NUMBER, salary NUMBER); INSERT INTO employees VALUES (1, 10, 5000); INSERT INTO employees VALUES (2, 10, 6000); INSERT INTO employees VALUES (3, 20, 7000); INSERT INTO employees VALUES (4, 20, 8000); CREATE VIEW dept_salary AS SELECT department_id, SUM(salary) AS total_salary FROM employees GROUP BY department_id; DELETE FROM dept_salary WHERE department_id = 10; SQL>ORA-01732: data manipulation operation not legal on this view DELETE FROM dept_salary; SQL>ORA-01732: data manipulation operation not legal on this view
upvoted 2 times
...
it6567306
2 months, 1 week ago
E is correct. CREATE TABLE employees ( employee_id NUMBER PRIMARY KEY, department_id NUMBER, salary NUMBER); INSERT INTO employees VALUES (1, 10, 5000); INSERT INTO employees VALUES (2, 10, 6000); INSERT INTO employees VALUES (3, 20, 7000); CREATE VIEW dept_salary AS SELECT department_id, SUM(salary) AS total_salary FROM employees GROUP BY department_id; INSERT INTO dept_salary VALUES (30, 10000); ORA-01733: virtual column not allowed here
upvoted 2 times
...
Oracle2020
3 months, 1 week ago
Correct answer is EFG A-FALSE :To issue a query or an INSERT, UPDATE, or DELETE statement against a view, you must have the SELECT, READ, INSERT, UPDATE, or DELETE object privilege for the view, respectively, either explicitly or through a role. D-FALSE:With some restrictions, rows can be inserted into, updated in, or deleted from a base table using a view. E,F-TRUE:If a view is defined by a query that contains SET or DISTINCT operators, a GROUP BY clause, or a group function, then rows cannot be inserted into, updated in, or deleted from the base tables using the view. G-TRUE: If a view is defined with WITH CHECK OPTION, a row cannot be inserted into, or updated in, the base table (using the view), if the view cannot select the row from the base table.
upvoted 2 times
...
Ajinkya_Tambe
8 months, 1 week ago
I think A,E,F,G all are correct
upvoted 2 times
...
zouve
11 months ago
Selected Answer: AFG
I had this question also on the 1Z0-071 exam. AG was the right answers in there but the question is a little bit different
upvoted 1 times
...
auwia
1 year ago
Selected Answer: EFG
For E, F, and G ; I cannot find any point against them, so probably they are corrects in my opinion. A, because the "updated" word I would say it's false, because we go in the case of DML op. when they are allowed and not on the view. The view must not contain any of the following constructs: A set operator a DISTINCT operator An aggregate or analytic function A GROUP BY, ORDER BY, MODEL, CONNECT BY, or START WITH clause A collection expression in a SELECT list A subquery in a SELECT list A subquery designated WITH READ ONLY Joins, with some exceptions, as documented in Oracle Database Administrator's Guide.
upvoted 2 times
auwia
1 year ago
For A, it should be ALTERED without needs of re-grant, not UPDATED.
upvoted 2 times
...
...
piontk
1 year ago
Selected Answer: AFG
E -> not always, in this case is a wrong statement. Test case: CREATE TABLE employees ( id NUMBER, name VARCHAR2(100), salary NUMBER, department_id NUMBER ); INSERT INTO employees VALUES(1, 'John Doe', 50000, 1); INSERT INTO employees VALUES(2, 'Jane Doe', 60000, 1); INSERT INTO employees VALUES(3, 'Robert Smith', 70000, 2); CREATE VIEW dept1_employees5 AS SELECT id, count(*) cnt FROM employees group by id; INSERT INTO dept1_employees5 (id) VALUES (4); This will not cause an error. Otherwise DELETE statement will: SQL> delete from dept1_employees5 where id=4; delete from dept1_employees5 where id=4 * ERROR at line 1: ORA-01732: data manipulation operation not legal on this view In my opinion correct answer is AFG
upvoted 2 times
...
CMjer
1 year, 2 months ago
Selected Answer: EFG
EFG is correct. - E, F: insert/update/delete is prevented when you have GROUP BY in defining query of a view. - G: true, that's what WITH CHECK clause does :)
upvoted 2 times
...
Kuraudio
1 year, 7 months ago
A is correct: Specify OR REPLACE to re-create the view if it already exists. You can use this clause to change the definition of an existing view without dropping, re-creating, and regranting object privileges previously granted on it. Remember that removing an object's privileges has a cascade effect, so with the "OR REPLACE" you avoid assigning the privileges again.
upvoted 1 times
...
Kuraudio
1 year, 7 months ago
A is wrong: Source: https://www.oracletutorial.com/oracle-view/oracle-with-check-option/
upvoted 1 times
Kuraudio
1 year, 7 months ago
Sorry, A is correct
upvoted 1 times
...
...
yarsalan
2 years, 5 months ago
Selected Answer: AFG
I think, A,F,G are correct
upvoted 1 times
...
Borislone
2 years, 11 months ago
D is correct
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago