Tag: databases

Questions Related to databases

  1. Backup and Recovery

  2. Transactions

  3. Security

  4. Queries


Correct Option: D

Which of the following is a typical data warehouse query?

  1. What is this customer’s address?

  2. Does this customer have any unpaid bills?

  3. What is the balance in this customer’s account?

  4. What is the total sales for each of the last 6 months?


Correct Option: D
  1. Current

  2. Projected

  3. Historical

  4. Current and Projected


Correct Option: A

A table named DEPARTMENT has the following columns: DEPT_ID DEPT_NAME MANAGER AVG_SALARY Which of the following is the best way to prevent most users from viewing AVG_SALARY data?

  1. Encrypt the table's data

  2. Create a view that does not contain the AVG_SALARY column

  3. Revoke SELECT access for the AVG_SALARY column from users who should not see AVG_SALARY data

  4. Store AVG_SALARY data in a separate table and grant SELECT privilege for that table to the appropriate users


Correct Option: B

Assuming USER1 has no authorities or privileges, which of the following will allow USER1 to create a view named VIEW1 that references two tables named TAB1 and TAB2?

  1. CREATEIN privilege on the database

  2. REFERENCES privilege on TAB1 and TAB2

  3. CREATE_TAB privilege on the database

  4. SELECT privilege on TAB1 and TAB2


Correct Option: D

AI Explanation

To answer this question, you need to understand the different privileges and authorities needed to create a view that references tables.

Let's go through each option to understand why it is correct or incorrect:

Option A) CREATEIN privilege on the database - This option is incorrect because the CREATEIN privilege allows the user to create objects within a specified schema, but it does not grant the user the ability to reference tables or create views.

Option B) REFERENCES privilege on TAB1 and TAB2 - This option is incorrect because the REFERENCES privilege allows the user to create foreign key constraints that reference the specified tables, but it does not grant the user the ability to create views.

Option C) CREATE_TAB privilege on the database - This option is incorrect because the CREATE_TAB privilege does not exist in the context of creating views. It may be a made-up privilege or a misrepresentation of the actual privilege required.

Option D) SELECT privilege on TAB1 and TAB2 - This option is correct because the SELECT privilege allows the user to query the specified tables and retrieve data. When creating a view, the user needs to reference the tables and retrieve data from them, which requires the SELECT privilege.

Therefore, the correct answer is Option D. This option is correct because the SELECT privilege on TAB1 and TAB2 allows USER1 to create a view named VIEW1 that references the two tables.

A user wishing to invoke an SQL stored procedure that queries a table must have which of the following privileges?

  1. CALL privilege on the procedure; SELECT privilege on the table

  2. CALL privilege on the procedure; REFERENCES privilege on the table

  3. EXECUTE privilege on the procedure; SELECT privilege on the table

  4. EXECUTE privilege on the procedure; REFERENCES privilege on the table


Correct Option: C

User USER1 wants to utilize an alias to remove rows from a table. Assuming USER1 has no authorities or privileges, which of the following privileges are needed?

  1. DELETE privilege on the table

  2. DELETE privilege on the alias

  3. DELETE privilege on the alias; REFERENCES privilege on the table

  4. REFERENCES privilege on the alias; DELETE privilege on the table


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of aliases and privileges in database management systems.

An alias is an alternative name given to a table or column in a database. It allows you to refer to the table or column by a different name in your queries, which can be helpful for simplifying or clarifying your code.

In this case, USER1 wants to utilize an alias to remove rows from a table. To do this, USER1 needs the DELETE privilege on the table. The DELETE privilege allows the user to delete rows from a table.

Let's go through each option to understand why it is correct or incorrect:

Option A) DELETE privilege on the table - This option is correct because USER1 needs the DELETE privilege on the table to remove rows from it.

Option B) DELETE privilege on the alias - This option is incorrect because privileges are granted on the underlying table, not on the alias. The alias is just a different name for the table and does not have its own set of privileges.

Option C) DELETE privilege on the alias; REFERENCES privilege on the table - This option is incorrect because, as mentioned earlier, privileges are granted on the underlying table, not on the alias. The REFERENCES privilege is used to create foreign key constraints, not for deleting rows.

Option D) REFERENCES privilege on the alias; DELETE privilege on the table - This option is incorrect for the same reasons as option C. The REFERENCES privilege is not needed for deleting rows, and privileges are granted on the underlying table, not on the alias.

Therefore, the correct answer is option A. USER1 needs the DELETE privilege on the table to remove rows from it.