SQL Server allows you to use programming constructs in the batches for conditional execution of statements. For example, you need to retrieve data based on a condition. If the condition is not satisfied, a message should be displ...
Monday, September 22, 2014
Saturday, September 20, 2014
Implementing Batches in SQL Server and Guidelines
As a database developer, you might need to execute more than one SQL statement to perform a task. For example, when a new employee joins AdventureWorks, Inc., you need to insert the employee details in the database. The details o...
Wednesday, June 4, 2014
How to Create Index using sql Query: Sql Server
Database programmer should create indexes on the most frequently queried column in a table. However, at times, you might need to create an index based on a combination of one or more columns. An index based on one or more columns...
Tuesday, February 18, 2014
How to use Correlated Subqueries in SQL Programming
In SQL programming, a correlated subquery can be defined as a query that depends on the outer query for its evaluation. In a correlated subquery, the WHERE clause references a table in the FROM clause. This means that the inner q...
Thursday, February 13, 2014
How to use Nested Subqueries in SQL Programming
A subquery can contain one or more subqueries. Subqueries are used when the condition of a query is dependent on the result of another query, which in turn is dependent on the result of another subquery.
Consider an example. You...
How to use Aggregate Functions in SubQuery with Database
While using subqueries, you can also use aggregate functions in the subqueries to generate aggregated values from the inner query. For example, in a manufacturing organization, the management wants to view the sale records of all...
Thursday, February 6, 2014
How to Querying Data by using Subqueries in SQL Programming
In SQL programming, while using subqueries, you can use the =,>, and < comparison operators to create a condition that checks the value returned by the subquery. When a subquery returns more than one value, you might need to appl...
Wednesday, February 5, 2014
How to Querying Data by using Subqueries in SQL Programming
IN
In SQL programming, if a subquery returns more than one value, you might need to execute the outer query if the values within the column specified in the condition match any value in the result set of the subquery. To perform...
Tuesday, February 4, 2014
How to Querying Data by using Subqueries in SQL Programming: Part 1
In SQL programming, while querying data from multiple tables, you might need to use the result of one query as an input for the condition of another query. For example, in the Adventure Works database, you need to view the design...
Friday, January 31, 2014
How to Querying Data using Joins in Sql Programming: Part 4
Equi Join
In SQL programming, an Equi join is the same as an inner join and joins tables with the help of a foreign key. However, an equi join is used to display all the columns from both the tables. The common column from all t...
How to Querying Data using Joins in Sql Programming: Part 3
A cross join, also known as Cartesian Product in SQL programming, between two tables joins each row from one table with each row of the other table. The number of rows in the result set is the number of rows in the first table mu...
Thursday, January 30, 2014
How to Querying Data using Joins in Sql Programming: Part 2
In comparison to an inner join, an outer join displays the result set containing all the rows from one table and the matching rows from another table. For example, if you create an outer join on Table A and Table B, it will show ...
Tuesday, January 28, 2014
How to Querying Data using Joins in Sql Programming
In a normalized database, the data to be viewed can be stored in multiple tables. When you need to view data from related tables together, you can query the data by joining the tables with the help of common attributes. You can a...