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 9270
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 6596
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 5592
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 5067
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 4909
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 4815
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 4807
Q:

Which TCP/IP port does SQL Server run on? How can it be changed?

Answer

SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

1 4657