Tag: databases

Questions Related to databases

  1. A role can be given to a maximum of 1000 users.

  2. A user can have access to a maximum of 10 roles.

  3. A role can have a maximum of 100 privileges contained in it.

  4. Privileges are given to a role by using the CREATE ROLE statement.

  5. A role is a named group of related privileges that can be granted to the user.

  6. A user can have access to several roles, and several users can be assigned the same role.


Correct Option: D,F
  1. The underlying tables must have data.

  2. You need SELECT privileges on the view.

  3. The underlying tables must be in the same schema.

  4. You need SELECT privileges only on the underlying tables.


Correct Option: D
  1. The two statements produce identical results.

  2. The second statement returns a syntax error.

  3. There is no need to specify DESC because the results are sorted in descending order by default.

  4. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement.


Correct Option: A
Explanation:

To solve this question, the user needs to understand the SQL SELECT statement and the ORDER BY clause. The ORDER BY clause is used to sort the result set in ascending or descending order based on one or more columns.

Now, let's go through each option and explain why it is right or wrong:

A. The two statements produce identical results. This option is correct. Both SQL statements select the same columns from the same table, and they both sort the results by the salary column in descending order. The syntax used to specify the column to sort by is different (column name vs. column position), but they are functionally equivalent.

B. The second statement returns a syntax error. This option is incorrect. The second SQL statement is also valid syntax and should execute without errors.

C. There is no need to specify DESC because the results are sorted in descending order by default. This option is incorrect. The ORDER BY clause sorts the result set in ascending order by default. If you want to sort in descending order, you need to explicitly specify the DESC keyword.

D. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement. This option is incorrect. The column alias does not affect the sorting behavior of the ORDER BY clause. It only changes the name of the column in the result set.

Therefore, the correct answer is:

The Answer is: A

  1. SELECT TO_DATE(SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;

  2. SELECT TO_CHAR(SYSDATE, 'FMDD, DY Month, 'YYY') FROM dual;

  3. SELECT TO_CHAR(SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;

  4. SELECT TO_CHAR(SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;

  5. SELECT TO_DATE(SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;


Correct Option: C
  1. SELECT SUBSTR( ‘Hello World’,1) FROM dual;

  2. SELECT INITCAP(TRIM (‘Hello World’, 1,1)) FROM dual;

  3. SELECT LOWER(SUBSTR(‘Hello World’, 1, 1) FROM dual;

  4. SELECT LOWER(SUBSTR(‘Hello World’, 2, 1) FROM dual;

  5. SELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;


Correct Option: E
  1. The value displayed in the CALC_VALUE column will be lower.

  2. The value displayed in the CALC_VALUE column will be higher.

  3. There will be no difference in the value displayed in the CALC_VALUE column.

  4. An error will be reported.


Correct Option: C
  1. /SQL*Plus commands cannot be abbreviated.

  2. /SQL*Plus commands are accesses from a browser.

  3. /SQL*Plus commands are used to manipulate data in tables.

  4. /SQL*Plus commands manipulate table definitions in the database.

  5. /SQL*Plus is the Oracle proprietary interface for executing SQL statements.


Correct Option: C,D
  1. The indexed column is declared as NOT NULL.

  2. The indexed columns are used in the FROM clause.

  3. The indexed columns are part of an expression.

  4. The indexed column contains a wide range of values.


Correct Option: D
  1. ORDER BY SALARY > 5000

  2. GROUP BY SALARY > 5000

  3. HAVING SALARY > 5000

  4. WHERE SALARY > 5000


Correct Option: D