0

databases Online Quiz - 164

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

Which SQL statement selects all rows from table called Contest, with column ContestDate having values greater or equal to May 25, 2006?

  1. SELECT * FROM Contest WHERE ContestDate >= '05/25/2006'

  2. SELECT * FROM Contest HAVING ContestDate >= '05/25/2006'

  3. SELECT * FROM Contest WHERE ContestDate < '05/25/2006'

  4. SELECT * FROM Contest IN ContestDate < '05/25/2006'


Correct Option: A
  1. INSERT INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project')

  2. INSERT Projects VALUES ('Content Development', 'Website content development project')

  3. INSERT Projects ('Content Development', 'Website content development project')

  4. SAVE INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project')


Correct Option: A
Explanation:

To insert data into a table called Projects, the user needs to use the INSERT statement.

Now let's go through each option and explain why it is right or wrong:

A. INSERT INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project'): This option is correct. This statement inserts data into the Projects table by specifying the column names (ProjectName and ProjectDescription) and their respective values ('Content Development' and 'Website content development project').

B. INSERT Projects VALUES ('Content Development', 'Website content development project'): This option is incorrect because it does not specify the column names. The correct syntax is to use INSERT INTO, followed by the table name and then the column names and values.

C. INSERT Projects ('Content Development', 'Website content development project'): This option is incorrect because it is missing the INTO keyword. The correct syntax is to use INSERT INTO, followed by the table name and then the column names and values.

D. SAVE INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project'): This option is incorrect because there is no SAVE keyword in SQL. The correct syntax is to use INSERT INTO, followed by the table name and then the column names and values.

Therefore, the correct answer is: A. INSERT INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project')

  1. SELECT * FROM Sales

  2. DELETE FROM Sales

  3. SELECT * FROM SALES WHERE OrderID < 1

  4. SELECT FROM Sales


Correct Option: A

Which of the following SQL statements deletes all rows in table called SalesData?

  1. DELETE FROM SalesData

  2. DELETE * FROM SalesData

  3. DELETE SalesData

  4. DELETE ALL SalesData


Correct Option: A
Explanation:

To solve this question, the user needs to know the basic syntax of the SQL DELETE statement. The correct answer is:

The Answer is: A

Explanation:

A. DELETE FROM SalesData: This option is correct because it follows the correct syntax for deleting all rows from a table. The DELETE statement is used to delete existing records in a table, and the FROM keyword specifies the table from which to delete the rows. So, this statement will delete all rows from the SalesData table.

B. DELETE * FROM SalesData: This option is incorrect because it does not follow the correct syntax for the DELETE statement. The asterisk (*) is not required in the DELETE statement and may cause an error.

C. DELETE SalesData: This option is also incorrect because it does not follow the correct syntax for the DELETE statement. The table name should be preceded by the keyword FROM, which is missing in this option.

D. DELETE ALL SalesData: This option is incorrect because it also does not follow the correct syntax for the DELETE statement. The keyword ALL is not necessary and will cause an error.

  1. To return the minimum value of a numeric expression.

  2. To return the absolute, positive value of a numeric expression.

  3. To return the maximum value of a numeric expression.

  4. To return the average value of a numeric expression.


Correct Option: B
  1. INSERT clause

  2. SELECT clause

  3. DELETE clause

  4. JOIN clause


Correct Option: B
  1. Selective Join.

  2. You can't join a table to itself.

  3. Self Join

  4. Outer Join


Correct Option: C
  1. MAX

  2. TOP

  3. MOST

  4. UPPER


Correct Option: A
Explanation:

To retrieve a maximum value in SQL, the user needs to know the appropriate keyword that retrieves the highest value from a column. The correct option is:

The Answer is: A

Option A: MAX is the correct keyword used to retrieve the maximum value from a column. It is an aggregate function in SQL that takes the column name as input and returns the highest value in that column.

Option B: TOP is a keyword used to limit the number of rows returned from an SQL query. It does not retrieve the maximum value from a column.

Option C: MOST is not a valid SQL keyword.

Option D: UPPER is a keyword used to convert a string to uppercase in SQL. It does not retrieve the maximum value from a column.

Which of the following SQL clauses specifies a search condition?

  1. WHERE

  2. SEARCH

  3. FROM

  4. WHILE


Correct Option: A

AI Explanation

To answer this question, you need to understand SQL clauses and their purposes. Let's go through each option to understand why it is correct or incorrect:

Option A) WHERE - This option is correct because the WHERE clause in SQL is used to specify a search condition. It is typically used in conjunction with the SELECT statement to filter rows based on a specific condition.

Option B) SEARCH - This option is incorrect because there is no SQL clause called SEARCH. The correct clause for specifying a search condition is WHERE.

Option C) FROM - This option is incorrect because the FROM clause in SQL is used to specify the table or tables from which to retrieve data, not to specify a search condition.

Option D) WHILE - This option is incorrect because the WHILE clause is not used in SQL to specify a search condition. It is typically used in looping constructs, such as in programming languages like SQL Server or MySQL.

The correct answer is A) WHERE. This option is correct because the WHERE clause is used in SQL to specify a search condition.

The IN SQL keyword…

  1. Determines if a value matches any of the values in a list or a sub-query.

  2. Defines the tables we are selecting or deleting data from.

  3. Is used with the DISTINCT SQL keyword only.

  4. Is used to select data from a view


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Determines if a value matches any of the values in a list or a sub-query - This option is correct. The IN keyword is used in SQL to determine if a value matches any of the values in a list or a sub-query. It is typically used in the WHERE clause of a query to specify a condition.

Option B) Defines the tables we are selecting or deleting data from - This option is incorrect. The FROM keyword is used to define the tables we are selecting or deleting data from in SQL.

Option C) Is used with the DISTINCT SQL keyword only - This option is incorrect. The IN keyword is not specifically used with the DISTINCT keyword. The IN keyword can be used with any other SQL keyword or clause.

Option D) Is used to select data from a view - This option is incorrect. The IN keyword is not specifically used to select data from a view. It is used to compare a value with a list of values or the result of a sub-query.

The correct answer is Option A. The IN keyword in SQL is used to determine if a value matches any of the values in a list or a sub-query.

A trigger is…

  1. a special type of table

  2. a special type of store procedure, executed when certain event occurs

  3. a special type of view

  4. an event


Correct Option: B

"select" - Belogns to

  1. DML

  2. MDL

  3. DDL

  4. All the above


Correct Option: A

"select E_Name,E_Number from EMP order by 2" This Query is

  1. True

  2. False


Correct Option: A

Which key word is used to remove a table from the database

  1. Delete

  2. Truncate

  3. Remove

  4. Drop


Correct Option: D

To Insert new a column in a table Tbl_Test which of the following query is used

  1. Alter table Tbl_Test Insert column New_Column varchar 20

  2. Alter table Tbl_Test Alter column New_Column varchar 20

  3. Alter table Tbl_Test add New_Column varchar 20

  4. Either a or b could be used


Correct Option: C

Calling a stored Procedure inside a view is Possible

  1. True

  2. False


Correct Option: A

In the following which is not a DDL ?

  1. Truncate

  2. Create

  3. Alter

  4. All the above


Correct Option: A

select Project_ID,Project_Name,Project_Status from Projects group by Project_ID,Project_Status,Project_Name

  1. True

  2. False


Correct Option: A

When "Join" is used in a query which should not be used with that

  1. On

  2. Where

  3. Having

  4. Non of the Above


Correct Option: D
- Hide questions