0

databases Online Quiz - 218

Description: databases Online Quiz - 218
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0
  1. Structured Query Language

  2. Strong Question Language

  3. Structured Question Language

  4. none of above


Correct Option: A

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

  1. OPEN

  2. GET

  3. SELECT

  4. EXTRACT


Correct Option: C
  1. SELECT Persons

  2. SELECT *.Persons

  3. SELECT * FROM Persons

  4. SELECT [all] FROM Persons


Correct Option: C
  1. SELECT * FROM Persons WHERE FirstName<>'Peter'

  2. SELECT [all] FROM Persons WHERE FirstName='Peter'

  3. SELECT * FROM Persons WHERE FirstName='Peter'

  4. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'


Correct Option: C
  1. What does SQL stand for?
  1. Structured Query Language

  2. Strong Question Language

  3. Structured Question Language

  4. None


Correct Option: A
  1. With SQL, how do you select a column named "FirstName" from a table named "Persons"?
  1. SELECT Persons.FirstName

  2. SELECT FirstName FROM Persons

  3. EXTRACT FirstName FROM Persons

  4. None


Correct Option: B

Can Primary Key be Null?

  1. True

  2. False


Correct Option: B

Can Sec Key be Null?

  1. True

  2. False


Correct Option: B

Can Composite Key be Null?

  1. True

  2. False


Correct Option: B

OBject Relational Database have entity relations?

  1. True

  2. False


Correct Option: B

Is DB2 database managament system?

  1. True

  2. False


Correct Option: A

Which SQL keyword is used to sort the result-set?

  1. SORT BY

  2. SORT

  3. ORDER

  4. ORDER BY


Correct Option: D

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

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

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

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

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


Correct Option: D

AI Explanation

To change "Hansen" into "Nilsen" in the "LastName" column in the "Persons" table, you would use the UPDATE statement. Let's go through each option to understand why it is correct or incorrect:

Option A) MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen' - This option is incorrect because the correct keyword to use for updating records in SQL is UPDATE, not MODIFY.

Option B) MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen' - This option is incorrect because the INTO keyword is not used in the UPDATE statement. The correct syntax is UPDATE table_name SET column_name = new_value WHERE condition.

Option C) UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen' - This option is incorrect because, again, the INTO keyword is not used in the UPDATE statement. Additionally, the new value should be 'Nilsen', not 'Hansen'.

Option D) UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen' - This option is correct. The UPDATE statement is used to modify records in a table. In this case, it will update the "LastName" column in the "Persons" table, setting the value to 'Nilsen' for all records where the current value in the "LastName" column is 'Hansen'.

Therefore, the correct answer is D.

With SQL, how can you return the number of records in the "Persons" table?

  1. SELECT COUNT(*) FROM Persons

  2. SELECT COLUMNS(*) FROM Persons

  3. SELECT COLUMNS() FROM Persons

  4. SELECT COUNT() FROM Persons


Correct Option: A

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

  1. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

  2. SELECT * FROM Persons WHERE FirstName<>'Peter'

  3. SELECT [all] FROM Persons WHERE FirstName='Peter'

  4. SELECT * FROM Persons WHERE FirstName='Peter'


Correct Option: D

AI Explanation

To select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter," you can use the following SQL query:

D. SELECT * FROM Persons WHERE FirstName='Peter'

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

Option A) SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter' - This option is incorrect because the "LIKE" operator is used for pattern matching and not for exact matching. In this case, we need to match the exact value of "Peter," so the "=" operator should be used instead.

Option B) SELECT * FROM Persons WHERE FirstName<>'Peter' - This option is incorrect because it selects all the records where the value of the column "FirstName" is not equal to "Peter." However, we want to select all the records where the value is equal to "Peter," so this option is not the correct choice.

Option C) SELECT [all] FROM Persons WHERE FirstName='Peter' - This option is incorrect because the keyword "all" is not necessary in the SELECT statement. The correct syntax is to use the asterisk (*) to select all columns.

Option D) SELECT * FROM Persons WHERE FirstName='Peter' - This option is correct because it selects all the records from the table "Persons" where the value of the column "FirstName" is equal to "Peter." This is the correct choice because it matches the given conditions.

The correct answer is D. SELECT * FROM Persons WHERE FirstName='Peter'. This option is correct because it selects the desired records where the value of the column "FirstName" is "Peter".

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 LIKE '%a'

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

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

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


Correct Option: D
- Hide questions