0

databases Online Quiz - 213

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

1)Which function is used to get the Current System Date and Time

  1. GetSystemDate()

  2. GetDate()

  3. GetCurrentDateTime()

  4. None


Correct Option: B

What will be the Output for the Below Query Select * from Retailer where rtrid = (select top 3 Rtrid from retailer)

  1. Return Top 3 Row in the Retailer Table

  2. Return Error

  3. Return No Record

  4. Return all Records from Retailer Table


Correct Option: B

Which function is used to get the Current System Date and Time

  1. GetSystemDate()

  2. GetDate()

  3. GetCurrentDateTime()

  4. None


Correct Option: B

What will be the Output for the Below Query

  1. Return Top 3 Row in the Retailer Table

  2. Return Error

  3. Return No Record

  4. Return all Records from Retailer Table


Correct Option: B

How many Primary Key can be set for an table

  1. 10

  2. 1

  3. 2

  4. Infinite


Correct Option: A

What will be the Output for Select Abs(25-45)

  1. Abs is not a recognized function name

  2. -20

  3. 20

  4. None


Correct Option: C

Which of the joins are available in SQL i) Inner Join ii) Left Outer Join iii) Cross Join iv) Self Join

  1. All the Above

  2. i) and ii)

  3. i), ii) and iii)

  4. None


Correct Option: A

How many Output Parameters can be set for an Stored Procedure

  1. One

  2. More than One

  3. None

  4. Stored Procedure Does not support Output Parameter


Correct Option: B

A User Defined Function can Return

  1. One Value

  2. More than One Value

  3. No Value

  4. User Defined Function will not return Value


Correct Option: B

A Trigger can be for

  1. Stored Procedure

  2. Function

  3. Table

  4. View


Correct Option: C

Which of the following is not a group function?

  1. Min( )

  2. Sqrt( )

  3. Sum( )

  4. max( )


Correct Option: B

Which SQL statement is used to extract data from a database?

  1. Open

  2. Get

  3. Extract

  4. None of the Above


Correct Option: C
  1. With SQL, 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
  1. With SQL, 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' AND LastName<>'Jackson'

  2. SELECT FirstName='Peter', LastName='Jackson' FROM Persons

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

  4. None


Correct Option: C
  1. With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
  1. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName

  2. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

  3. SELECT LastName>'Hansen' AND LastName

  4. None


Correct Option: B
  1. Which SQL keyword is used to sort the result-set? SORT BY ORDER BY SORT ORDER
  1. SORT BY

  2. ORDER BY

  3. SORT

  4. ORDER


Correct Option: B

AI Explanation

To answer this question, you need to understand SQL queries and the keyword used to sort the result-set.

Option A) SORT BY - This option is incorrect because there is no such keyword in SQL.

Option B) ORDER BY - This option is correct. The "ORDER BY" keyword is used in SQL to sort the result-set in ascending or descending order based on one or more columns.

Option C) SORT - This option is incorrect because there is no "SORT" keyword in SQL.

Option D) ORDER - This option is incorrect because "ORDER" alone is not a valid keyword to sort the result-set in SQL.

The correct answer is B) ORDER BY. This option is correct because "ORDER BY" is the keyword used in SQL to sort the result-set.

  1. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
  1. SELECT * FROM Persons SORT BY 'FirstName' DESC

  2. SELECT * FROM Persons SORT 'FirstName' DESC

  3. SELECT * FROM Persons ORDER BY FirstName DESC

  4. SELECT * FROM Persons ORDER FirstName DES


Correct Option: C
  1. With SQL, how can you insert a new record into the "Persons" table?
  1. INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

  2. INSERT ('Jimmy', 'Jackson') INTO Persons

  3. INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

  4. None


Correct Option: C
  1. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
  1. INSERT INTO Persons ('Olsen') INTO LastName

  2. INSERT ('Olsen') INTO Persons (LastName)

  3. INSERT INTO Persons (LastName) VALUES ('Olsen')

  4. None


Correct Option: C
  1. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
  1. DELETE ROW FirstName='Peter' FROM Persons

  2. DELETE FROM Persons WHERE FirstName = 'Peter'

  3. DELETE FirstName='Peter' FROM Persons

  4. None


Correct Option: B

AI Explanation

To delete records where the "FirstName" is "Peter" in the Persons Table, you would use the DELETE statement with the WHERE clause to specify the condition.

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

Option A) DELETE ROW FirstName='Peter' FROM Persons - This option is incorrect because the correct syntax is DELETE FROM, not DELETE ROW. Additionally, the WHERE clause is missing.

Option B) DELETE FROM Persons WHERE FirstName = 'Peter' - This option is correct. The DELETE statement is used to delete records from a table, and the WHERE clause is used to specify the condition. In this case, it is deleting records where the "FirstName" is "Peter" from the "Persons" table.

Option C) DELETE FirstName='Peter' FROM Persons - This option is incorrect because the correct syntax is DELETE FROM, not DELETE. Additionally, the WHERE clause is missing.

Option D) None - This option is incorrect because there is a correct option.

The correct answer is B. This option is correct because it uses the correct syntax with the DELETE statement and the WHERE clause to delete records where the "FirstName" is "Peter" from the "Persons" table.

- Hide questions