0

databases Online Quiz - 145

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

Which SQL statement selects all rows from a table called Products and orders the result set by ProductID column?

  1. SELECT * FROM Products ORDER BY ProductID

  2. SELECT * FROM Products WHERE ProductID > 200

  3. SELECT * FROM Products ORDERED BY ProductID

  4. SELECT ProductID FROM Products


Correct Option: A
  1. Selects all Customers from the Sales table

  2. Selects all customers from table Sales that have made more than 5 orders.

  3. Selects the total number of orders from the Sales table, if this number is greater than 5

  4. Selects no records


Correct Option: B

What is a foreign key?

  1. The foreign key is a column that can have NULL values.

  2. The foreign key is a SQL locking mechanism.

  3. A foreign key is a key field (column) in a database table, which relates the table to another table where the key is a primary key. The primary - foreign key relations are used to cross-reference database tables.

  4. The foreign key is a column that should be primary key for that table.


Correct Option: C
Explanation:

To understand what a foreign key is, the user needs to have a basic understanding of database design.

The correct answer is:

C. A foreign key is a key field (column) in a database table, which relates the table to another table where the key is a primary key. The primary-foreign key relations are used to cross-reference database tables.

Explanation of options:

A. This option is incorrect because a foreign key cannot have NULL values. A foreign key must reference a valid primary key in another table.

B. This option is incorrect because a foreign key is not related to SQL locking mechanisms. SQL locking mechanisms are used to manage concurrent access to data.

D. This option is incorrect because a foreign key cannot be a primary key for that table. A primary key is a unique identifier for a table, while a foreign key is used to reference a primary key in another table.

Which SQL statement inserts data into a table called Projects?

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

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

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

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


Correct Option: C

AI Explanation

To answer this question, we need to understand the syntax of the SQL INSERT statement. The correct statement should have the following format:

INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);

Let's go through each option to determine the correct statement:

Option A) INSERT Projects VALUES ('Content Development', 'Website content development project') - This option is incorrect because it is missing the "INTO" keyword before the table name.

Option B) INSERT Projects ('Content Development', 'Website content development project') - This option is incorrect because it is missing the "INTO" keyword before the table name, and it does not specify the column names.

Option C) INSERT INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project') - This option is correct. It uses the correct syntax of the INSERT statement, specifying the table name (Projects), column names (ProjectName, ProjectDescription), and the corresponding values.

Option D) SAVE INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Website content development project') - This option is incorrect because it uses the incorrect keyword "SAVE" instead of "INSERT INTO".

The correct answer is Option C. This option is correct because it follows the correct syntax of the INSERT statement, specifying the table name (Projects), column names (ProjectName, ProjectDescription), and the corresponding values.

Which of the following SQL statements is correct?

  1. SELECT FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006')

  2. SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'

  3. SELECT FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'

  4. SELECT * FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006')


Correct Option: B

AI Explanation

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

Option A) SELECT FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006') - This option is incorrect because the syntax is incorrect. The correct syntax for the BETWEEN operator is "value BETWEEN value1 AND value2".

Option B) SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006' - This option is correct because it uses the correct syntax for the BETWEEN operator. The date values are enclosed in single quotes and separated by the keyword "AND".

Option C) SELECT FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006' - This option is incorrect because the SELECT statement is missing the column names to select from the Sales table.

Option D) SELECT * FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006') - This option is incorrect because the date values are enclosed in parentheses, which is not the correct syntax for the BETWEEN operator.

The correct answer is B. This option is correct because it uses the correct syntax for the BETWEEN operator and selects all columns from the Sales table where the Date is between '10/12/2005' and '01/01/2006'.

If you join a table to itself, what kind of join are you using?

  1. Self Join

  2. Selective Join.

  3. Outer Join

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


Correct Option: A
  1. GROWN

  2. FROM

  3. UPDATING

  4. DELETING


Correct Option: B
Explanation:

To solve this question, the user needs to know what a reserved SQL keyword is. A reserved SQL keyword is a word that has a special meaning in SQL and cannot be used as a name for a table, column, or other database object.

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

A. GROWN: This option is incorrect because "GROWN" is not a reserved SQL keyword. It is not a commonly used SQL keyword and can be used as a name for a table, column, or other database object.

B. FROM: This option is correct. "FROM" is a reserved SQL keyword that is used to specify the table or tables from which to retrieve data in a SELECT statement. It is a commonly used SQL keyword and cannot be used as a name for a table, column, or other database object.

C. UPDATING: This option is incorrect because "UPDATING" is not a reserved SQL keyword. While "UPDATE" is a reserved SQL keyword that is used to modify data in a table, "UPDATING" is not a commonly used SQL keyword and can be used as a name for a table, column, or other database object.

D. DELETING: This option is incorrect because "DELETING" is not a reserved SQL keyword. While "DELETE" is a reserved SQL keyword that is used to remove rows from a table, "DELETING" is not a commonly used SQL keyword and can be used as a name for a table, column, or other database object.

The Answer is: B

  1. Use SELECT COUNT(*)...in db2 query

  2. Use SELECT DISTINCT...in db2 query

  3. Use SELECT MAX(...)...in db2 query

  4. Use SELECT ROWNUM(*)...in db2 query


Correct Option: A

What is the physical storage length of DB2 data types-DATE,TIME,TIMESTAMP?

  1. 8 bytes, 6 bytes, 26 bytes

  2. 4 bytes, 3 bytes, 13 bytes

  3. 4 bytes, 3 bytes, 10 bytes

  4. 10 bytes, 8 bytes, 26 bytes


Correct Option: D

How do you eliminate duplicate values in DB2 SELECT?

  1. Use SELECT UNION(*)...in db2 query

  2. Use SELECT DISTINCT...in db2 query

  3. Use SELECT UNION ALL(...)...in db2 query

  4. Use SELECT DISTINCT ALL(*)...in db2 query


Correct Option: B

DB2 is a relational database

  1. True

  2. False


Correct Option: A

One table can have more than one tablespace

  1. True

  2. False


Correct Option: A

SSIS uses connection managers to integrate different data sources into packages. IS Analysis Services Connection Manager is available?

  1. True

  2. False


Correct Option: A

To Connect to Oracle database from SSIS OLE DB Connection Manager is not used.

  1. True

  2. False


Correct Option: B

Execute Process Task is Control Flow Item .

  1. True

  2. False


Correct Option: A

It is not Possible to Send Mail directly From SSIS Packages using

  1. True

  2. False


Correct Option: B

Script component is used in both Control Flow as well as Data Flow.

  1. True

  2. False


Correct Option: B

OLEDB Command can be used to call Store Procedure from Database in data Flow Task.

  1. True

  2. False


Correct Option: A

For each loop is used to repeat a task by enumerating over a group of objects.

  1. True

  2. False


Correct Option: A
- Hide questions