SQL Questions

Q:

A UNION query is which of the following?

A) Combines the output from multiple queries and does not include the same number of columns. B) Combines the output from multiple queries and must include the same number of columns.
C) Combines the output from no more than two queries and does not include the same number of columns. D) Combines the output from no more than two queries and must include the same number of columns.
 
Answer & Explanation Answer: B) Combines the output from multiple queries and must include the same number of columns.

Explanation:

A UNION query combines the output from multiple queries and must include the same number of columns.

Report Error

View Answer Report Error Discuss

Filed Under: SQL
Job Role: Analyst , Database Administration , IT Trainer

2 9997
Q:

A DBMS query language is designed to

A) Specify the structure of a database B) Support in the development of complex applications software
C) Support end users who use English-like commands D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: SQL
Job Role: Analyst , Database Administration , IT Trainer

2 6840
Q:

Write a SQL Query to find year from date.

Answer

SELECT YEAR(GETDATE()) as "Year";

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

2 5752
Q:

How would apply date range filter?

Answer

One can use simple conditions like >= and <=, or use between/and but the trick here is to know your exact data type.


 


- Sometimes date fields contain time and that is where the query can go wrong so it is recommended to use some date related functions to remove the time issue. In SQL Server common function for accomplishing the task datediff () function.


- Interviewees also have to be aware of different time zones and server time zone.


-To increase query performance you may still want to use between however you should be aware of proper format you should use if not it might misbehave during filtering.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

1 5250
Q:

Which one of the following sorts rows in SQL?

A) ORDER BY B) GROUP BY
C) SORT BY D) ALIGN BY
 
Answer & Explanation Answer: A) ORDER BY

Explanation:
Report Error

View Answer Report Error Discuss

0 5137
Q:

Can SQL Servers linked to other servers like Oracle?

Answer

SQL Server can be linked to any server provided it has OLE-DB provider from Microsoft to allow a link. E.g. Oracle has an OLE-DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

0 5082
Q:

SQL views can be used to hide?

A) Complicated SQL syntax B) Rows
C) Columns D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:

In SQL, a SQL view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table.

 

SQL views can be used to hide rows and columns and complicated SQL syntax.

 

The fields in a view are fields from one or more real tables in the database.

Report Error

View Answer Report Error Discuss

Filed Under: SQL
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

3 4995
Q:

Write an SQL Query to find employees whose name starts with an ‘M’?

Answer

SELECT *FROM Employees WHERE EmpName like ‘M%’.


 

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

0 4964