0

databases Online Quiz - 228

Description: databases Online Quiz - 228
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

We refer to a join as a self-join when…

  1. we are joining more than 2 tables

  2. we are joining table to itself

  3. we are using left and right join together

  4. none of the above


Correct Option: D

AI Explanation

To answer this question, we need to understand what a self-join is.

A self-join occurs when we join a table to itself. In other words, we treat the table as two separate entities and join them based on a common column or condition.

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

Option A) We are joining more than 2 tables - This option is incorrect. Joining more than 2 tables is not a defining characteristic of a self-join.

Option B) We are joining a table to itself - This option is correct. A self-join occurs when we join a table to itself, treating it as two separate entities.

Option C) We are using left and right join together - This option is incorrect. Using left and right joins together is not a defining characteristic of a self-join.

Option D) None of the above - This option is the correct answer. The correct definition of a self-join is given in option B, and none of the other options accurately describe a self-join.

The correct answer is D) None of the above. This option is correct because a self-join occurs when we join a table to itself.

What is the correct order of the ">" and the "=" operators, when we want to specify greater or equal search condition?

  1. >=

  2. Neither of the other two.

  3. =>

  4. !>=


Correct Option: D

What does the HAVING clause do?

  1. The HAVING keyword specifies a search condition for an aggregate or a group

  2. The HAVING keyword is used to select distinct values

  3. The HAVING keyword is used to join 2 or more tables.

  4. None of the above


Correct Option: D

What does follow after the SQL SELECT clause?

  1. The JOIN SQL clause.

  2. List of columns that will be selected or the * symbol.

  3. The name of the table we are selecting from.

  4. None of the above


Correct Option: D

What is an index?

  1. An index is the same as alias.

  2. An index is a special way to join 2 or more tables.

  3. An index is a database table attribute, which speeds-up data search within a table.

  4. None of the above


Correct Option: D

What is a view?

  1. A view is a special stored procedure executed when certain event occurs.

  2. A view is a database diagram.

  3. A view is a virtual table which results of executing a pre-compiled query. A view is not part of the physical database schema, while the regular tables are

  4. None of the above


Correct Option: D

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table

  1. UPDATE Persons SET LastName='Hansen' WHERE LastName='Nilsen'

  2. MODIFY Persons SET LastName='Hansen' WHERE LastName='Nilsen'

  3. UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

  4. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'


Correct Option: C
Explanation:

To change "Hansen" into "Nilsen" in the "LastName" column in the Persons table, the user needs to use SQL UPDATE statement.

UPDATE statement is used to modify the existing records in a table.

Now, let's go through each option:

A. UPDATE Persons SET LastName='Hansen' WHERE LastName='Nilsen': This option is incorrect because it will change the LastName to "Hansen" where LastName is "Nilsen". This will not change "Hansen" to "Nilsen".

B. MODIFY Persons SET LastName='Hansen' WHERE LastName='Nilsen': This option is incorrect because MODIFY is not a valid keyword in SQL. Also, this statement will change LastName to "Hansen" where LastName is "Nilsen". This will not change "Hansen" to "Nilsen".

C. UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen': This option is correct because it will change LastName to "Nilsen" where LastName is "Hansen". This will change "Hansen" into "Nilsen" in the LastName column.

D. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen': This option is incorrect because MODIFY is not a valid keyword in SQL. Also, this statement will change LastName to "Nilsen" where LastName is "Hansen". This will change "Hansen" into "Nilsen" in the LastName column.

The Answer is: C

how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"

  1. SELECT * FROM Persons WHERE FirstName='%a%'

  2. SELECT * FROM Persons WHERE FirstName='a'

  3. SELECT * FROM Persons WHERE FirstName LIKE '%a'

  4. SELECT * FROM Persons WHERE FirstName LIKE 'a%'


Correct Option: D

how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"

  1. SELECT * FROM Persons WHERE FirstName='Peter',LastName='Jackson'

  2. SELECT * FROM Persons WHERE FirstName='Peter' OR LastName='Jackson'

  3. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

  4. SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'


Correct Option: C

how can you return all the records from a table named "Persons" sorted descending by "FirstName"

  1. SELECT * FROM Persons ORDER BY FirstName DESC

  2. SELECT * FROM Persons SORT BY 'FirstName' DESC

  3. SELECT * FROM Persons SORT 'FirstName' DESC

  4. SELECT * FROM Persons ORDER FirstName DESC


Correct Option: A

Which SQL statement is used to return only different values

  1. SELECT DIFFERENT

  2. SELECT DISTINCT

  3. SELECT COUNT

  4. SELECT UNIQUE


Correct Option: B

The file extension .xlt gets created when

  1. you save and close the file

  2. you save excel in XML format

  3. you create an excel template

  4. you save it in Excel 2007 version


Correct Option: C

When you press Shift + Space bar

  1. An entire column gets selected in MS Excel

  2. The entire worksheet gets selected in MS Excel

  3. An entire row gets selected in MS Excel

  4. Nothing happens


Correct Option: C

Which of the following can be a valid column name?

  1. Column

  2. 123_Invoices

  3. Catch_#22

  4. #Invoices

  5. None of the above


Correct Option: C

When you press Alt + V + Z + 2, the worksheet view zooms to ____ %

  1. 2%

  2. 20%

  3. 25%

  4. 200%


Correct Option: C

The quickest way of creating a chart (graph) in excel is by choosing a data range and pressing

  1. Shift + F1

  2. Ctrl + 1

  3. F11 or ALT+F1

  4. Ctrl + Shift + F1


Correct Option: C
  1. The cell gets formatted to Number category with 2 decimal places

  2. The cell gets formatted to Number category with 4 decimal places

  3. The cell gets formatted into different font

  4. Nothing happens


Correct Option: A

The TRUNCATE command writes user data to Rollback segments

  1. True

  2. False


Correct Option: B

To produce a meaningful result set without any cartesian products, what is the minimum number of conditions that should appear in the WHERE clause of a that joins 'N' tables?

  1. 4

  2. 3

  3. N - 1

  4. N + 1


Correct Option: C
Explanation:

To solve this question, the user needs to have a basic understanding of SQL joins and how to prevent cartesian products.

When joining N tables, the minimum number of conditions that should appear in the WHERE clause to produce a meaningful result set without any cartesian products is N - 1. This is because each join condition connects two tables, and N tables can be connected by N - 1 join conditions.

Option A (4) and Option B (3) are not correct because they provide specific numbers of conditions that do not apply to all cases. The number of conditions needed depends on the number of tables being joined, which is not specified in the question.

Option C (N - 1) is correct, as explained above.

Option D (N + 1) is incorrect because adding an additional condition would result in a more restrictive query, potentially excluding valid results.

Therefore, the answer is: C. N - 1.

When a user creates an object without a TABLESPACE clause, where will Oracle store the segment?

  1. System tablespace

  2. Users tablespace

  3. Default tablespace for the user

  4. Oracle will give an error


Correct Option: C
- Hide questions