SQL Questions

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 4832
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 4697
Q:

How can you generate debugging output from PL/SQL?

Answer

Use the DBMS_OUTPUT package. Another possible method is to use the SHOW ERROR command.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

0 4454
Q:

What operator tests column for the absence of data?

A) NOT operator B) IS NULL operator
C) EXISTS operator D) All of the above
 
Answer & Explanation Answer: B) IS NULL operator

Explanation:

SELECT "column_name"


FROM "table_name"


WHERE "column_name" IS NULL.

Report Error

View Answer Report Error Discuss

1 4449
Q:

Which SQL keyword is used to sort the result-set?

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

Explanation:

SQL keyword ORDER BY is used to sort the result-set.

Report Error

View Answer Report Error Discuss

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

1 4346
Q:

What is the difference between JOIN and UNION?

Answer

SQL JOIN allows access to records of other table based on the given conditions between two tables.


Ex: If we are provided with the department ID of each employee, then we can use the department ID of the employee table to merge with the department ID of the department table to access department names.


UNION operation allows addition of 2 similar data sets to create a resulting set that contains all the data from the source data sets.


Ex: If we are provided with 2 employee tables of the same structure, we can UNION them to create a singular result that will contain all employee from both the table.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

1 4319
Q:

What is Log Shipping?

Answer

Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and can be used this as the Disaster Recovery plan. The key feature of log shipping is that it will automatically backup transaction logs throughout the day and automatically restore them on the standby server at defined interval.

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

0 4084
Q:

Write SQL Query to find second highest salary of Employee.

Answer

There are many ways to find second highest salary of Employee in SQL, you can either use SQL Join or Subquery to solve this problem. Here is SQL query using Subquery :


SELECT MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary) FROM Employee );

Report Error

View answer Workspace Report Error Discuss

Subject: SQL

2 3809