Tag: databases

Questions Related to databases

  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
  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

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 DESC


Correct Option: C

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

  1. OPEN

  2. EXTRACT

  3. SELECT

  4. GET


Correct Option: C

Which SQL statement is used to update data in a database?

  1. UPDATE

  2. MODIFY

  3. SAVE

  4. SAVE AS


Correct Option: A

AI Explanation

To answer this question, you need to understand the basic SQL syntax and operations.

The correct answer is A) UPDATE.

Explanation for each option:

A) UPDATE - This option is correct. The UPDATE statement is used to modify or update existing data in a database table.

B) MODIFY - This option is incorrect. The MODIFY statement is not a valid SQL statement for updating data. It is typically used in conjunction with the ALTER TABLE statement to modify the structure or definition of a table.

C) SAVE - This option is incorrect. The SAVE statement is not a valid SQL statement for updating data. SQL does not have a specific statement for saving data in a database.

D) SAVE AS - This option is incorrect. The SAVE AS statement is not a valid SQL statement for updating data. SQL does not have a specific statement for saving data with a new name or as a copy.

In conclusion, the correct answer is A) UPDATE. This statement is used to modify or update existing data in a database table.

Which SQL statement is used to insert new data in a database?

  1. ADD NEW

  2. INSERT INTO

  3. ADD RECORD

  4. INSERT NEW


Correct Option: B
  1. Strong Question Language

  2. Structured Query Language

  3. Structured Question Language

  4. Strong Query Language


Correct Option: B
  1. SELECT * FROM Persons

  2. SELECT [all] FROM Persons

  3. SELECT Persons

  4. SELECT FROM Persons


Correct Option: A

Which SQL statement is used to return only different values?

  1. SELECT DIFFERENT

  2. SELECT UNIQUE

  3. SELECT DISTINCT

  4. SELECT EXACT


Correct Option: C

AI Explanation

To answer this question, you need to understand how to retrieve only distinct values from a table using SQL queries. Let's go through each option to understand why it is correct or incorrect:

Option A) SELECT DIFFERENT - This option is incorrect because there is no SQL keyword or function called "DIFFERENT" to retrieve only different values.

Option B) SELECT UNIQUE - This option is incorrect because "UNIQUE" is not used as a keyword or function to retrieve only different values. Instead, "UNIQUE" is used to enforce uniqueness on a column or a combination of columns in a table.

Option C) SELECT DISTINCT - This option is correct because the "DISTINCT" keyword is used in SQL to retrieve only different values from a column or a combination of columns in a table. It eliminates duplicate values and returns only unique values.

Option D) SELECT EXACT - This option is incorrect because there is no SQL keyword or function called "EXACT" to retrieve only different values.

The correct answer is Option C) SELECT DISTINCT. This option is correct because the "DISTINCT" keyword is used to return only different values.