Tag: databases

Questions Related to databases

  1. Substitution variables

  2. Replacement variables

  3. Prompt variables

  4. Instead-of variables


Correct Option: A
Explanation:

To solve this question, the user needs to know the basic functionalities of SQL*Plus.

The feature that can be used to replace values in the WHERE clause is Substitution variables.

Option A is correct. Substitution variables can be used to replace values in the WHERE clause at runtime. They begin with an ampersand (&) and can be used to replace any part of the SQL query, including the WHERE clause.

Option B is incorrect. Replacement variables are not a feature of SQL*Plus, and they cannot be used to replace values in the WHERE clause.

Option C is incorrect. Prompt variables are also not a feature of SQL*Plus and cannot be used to replace values in the WHERE clause.

Option D is incorrect. Instead-of variables are not a feature of SQL*Plus and cannot be used to replace values in the WHERE clause.

The answer is: A

  1. 17000.00

  2. 17000*****

  3. ****170.00

  4. **17000.00

  5. an error statement


Correct Option: C
Explanation:

To understand this SQL statement, the user should know about the LPAD function, which pads a string with a specified character until the string reaches a specified length. In this case, the salary column will be padded with asterisks (*) until it is 10 characters long.

The WHERE clause restricts the query to employees with an EMP_ID of 1001.

Assuming the employee with EMP_ID 1001 has a salary of 17000, the LPAD function will pad the salary with asterisks () until it has a length of 10 characters, resulting in the string "***17000". Therefore, the correct answer is:

The Answer is: A. ****170.00

For which action can you use the TO_DATE function?

  1. Convert any date literal to a date

  2. Convert any numeric literal to a date

  3. Convert any character literal to a date

  4. Convert any date to a character literal

  5. Format ’10-JAN-99’ to ‘January 10 1999’


Correct Option: C
Explanation:

To use the TO_DATE function, you need to know the purpose of the function and what it does. The TO_DATE function is used to convert a character string to a date format. The user needs to know that this function is used to convert a character string to a date format.

Now, let's evaluate each option to determine which one uses the TO_DATE function correctly:

A. Convert any date literal to a date - This option is incorrect. The TO_DATE function is used to convert character literals to a date format, not date literals.

B. Convert any numeric literal to a date - This option is incorrect. The TO_DATE function is used for character literals, not numeric literals.

C. Convert any character literal to a date - This option is correct. The TO_DATE function is used to convert character literals to a date format.

D. Convert any date to a character literal - This option is incorrect. The TO_CHAR function is used to convert dates to character literals, not the TO_DATE function.

E. Format ’10-JAN-99’ to ‘January 10 1999’ - This option is incorrect. The TO_CHAR function is used to format dates, not the TO_DATE function.

Therefore, the answer is: C. Convert any character literal to a date

Which one is a system privilege?

  1. select

  2. delete

  3. execute

  4. alter table

  5. create table


Correct Option: E
  1. String

  2. Character

  3. Integer

  4. Calander

  5. Numeric

  6. Translation


Correct Option: B,E
  1. The UNIQUE constraint does not permit a null value for the column.

  2. A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.

  3. The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.

  4. The NOT NULL constraint ensures that null values are not permitted for the column.


Correct Option: A,D

The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement accomplishes this?

  1. GRANT select ON dept TO ALL_USERS;

  2. GRANT select ON dept TO ALL;

  3. GRANT QUERY ON dept TO ALL_USERS;

  4. GRANT select ON dept TO PUBLIC;


Correct Option: D
  1. Unique

  2. Not null

  3. Check

  4. Primary key

  5. Foreign key


Correct Option: B
  1. a schema object

  2. a subquery that can contain an ORDER BY clause

  3. another name for a view that contains group functions

  4. a subquery that is part of the FROM clause of another query


Correct Option: D