SQL Questions

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 5672
Q:

A subquery in an SQL SELECT statement is enclosed in

A) [ ] B) { }
C) < > D) ( )
 
Answer & Explanation Answer: D) ( )

Explanation:

A subquery in an SQL SELECT statement is enclosed in parenthesis (...).

Report Error

View Answer Report Error Discuss

0 5597
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 5355
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 4775
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 4637
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 4526
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 4374
Q:

What are the properties and different Types of Sub-Queries?

Answer

Properties of Sub-Query


- A sub-query must be enclosed in the parenthesis.


- A sub-query must be put in the right hand of the comparison operator, and


- A sub-query cannot contain an ORDER-BY clause.


- A query can contain more than one sub-query.


Types of Sub-Query


- Single-row sub-query, where the sub-query returns only one row.


- Multiple-row sub-query, where the sub-query returns multiple rows,. and


- Multiple column sub-query, where the sub-query returns multiple columns

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

1 4202