SQL JOINS are required when you want to match values from different tables and get the common result out of it. Depending upon various criteria we can used different joins mainly INNER Join, LEFT OUTER Join, RIGHT OUTER Join and FULL OUTER Join. Let us explore each of these type of joins in detail

Data Set

We have two tables customer and seller and the data from these two tables is shown below:

Customer table

Seller table

INNER JOIN

INNER join returns all the rows from both the tables where the join condition is met.

Share this:

Introduction to SQL

SQL or Structured Query Language is the language we use to work with the Relational database. Although the syntax differs from vendor to vendor, but moreover the structure of the language is same. What’s better way to learn a language than actually using it to perform some operation.

CRUD Create, Retrieve, Update and Delete are the basic operations that we will perform using SQL

Create Operation

In this example we are going to create a table and insert some data into that table using SQL

Share this:

R is powerful language for doing the statistical analysis of your data and visualize the result. In the last decade, R has gained tremendous traction among the people involved in data and business analyses. Being open source, R has attracted some unique contributions from the community because of which it now stands tall when compared to industry leading solutions like SAS & SPSS

Playing with R

R is available for download at http://www.r-project.org/. By default, R comes as a command line offering but there are options present for those who like to work in an IDE environment.

RStudio provides the same level of flexibility what command line offer with some added advantage. Before you use RStudio, you must have R installed on your system. When you install RStudio on your system, it should look something like this:

Writing some basic samples

When you first start RStudio, you will be presented with some boilerplate information on the console (left hand side). If you want to get rid of that content, just use CTRL + L. You can clear out the console pressing Edit menu as well

To create a new file in RStudio, you can use CTRL + SHIFT + N or you can click the little plus sign on the top left corner of the screen as shown below

Let’s write some sample statements and see how to execute them to get the result

In this sample program, I am adding two number 1 + 5

To execute this statement, Go to Line number 3 and press CTRL + ENTER

[1] shows the index of the vector and along with it, console out put shows 6 which is the summation result.

Share this:

In the world of client-server architecture, there is always a confusion related to what responsibilities are handled by a web server and an app server. In this post we will go deep into the roles played by both

What is Web Server

A Simple Web Server works on HTTP protocol and does the job of receiving the client requests and sending the responses back to the client. Most of the times the responses will include static HTML pages or images or simple redirection of the client request to the suitable program to handle them.

On a high level, it can be understood that web server do not handle the logic of business but simply delegates the task to some other program which generates the response. Web server simply takes that response and send it back to the client. Web servers are designed to handle Fault tolerance, Load balancing, Multiple Threads, etc.

Examples of Web Server: Tomcat

What is Application Server

Application Server is the super set of web server. The main responsibility of Application Server is to handle the business logic for client result processing. Segregating business logic from the Web Server provides flexibility to share the business logic by different clients.

Why it is important to keep Web and App Server separate

Imagine a case when all the stuff of doing the business is handled by the web server. So in this case, server contains the script that performs the business logic and generates the result. Server then takes the result and sends the response back to the client

The main Disadvantage of this approach is in case of any issue or delay with HTTP Request/Response generation, the over all performance of the system goes down, even if there are no issues from the business processing side.

Another major disadvantage is that the business logic cannot be shared with different clients. So the logic cannot be reused at all which increases the cost of maintenance further.

In the above design, business logic is kept separate in application server. Thus, in case of fail the instance of web server changes and the application can keep on running without any issues with the same level of performance.

Considering the best practices, it is good to keep the business logic separate from re-usability point of view.

Share this:

While working with HTML pages during design or prototyping, most of the times we have to access the HTML page elements and depending upon some user action values of those HTML elements can be manipulated. In this post, we will explore the ways to access different HTML elements while working with user data and manipulating the data assigned to them.

Here is a sample HTML page with text boxes defined for getting the user data

Share this:

Ever wondered why !DOCTYPE html is written at the beginning of an HTML document. Well, it’s not an HTML tag. It’s an instruction to the web browser to tell about HTML version which is used to write that particular HTML document.

Document Object Model or DOM is a programming interface for the document (HTML, Dynamic HTML or XML) which provide the ability to manipulate the elements (HTML tags and String literal) that makes up a document.

In a normal scenario, when server sends the response in the form of an HTML page, browser takes that HTML page and keeps it in memory. The responsibility of DOM is to create a hierarchy structure of HTML elements from the HTML page stored in browser’s memory.

Structure of DOM

HTML document have a hierarchical structure in which document objects are represented as a TREE. Each node of Tree represents an HTML document (tags, string text). Let us look at a small example:

Each of these nodes represents a Node object. Node object has some methods and properties to traverse these nodes in HTML document. Some of these properties are nextChild, previousChild, nextSibling, previousSibling.

In the next section, we will see how to access these property in an HTML document using JavaScript console

Accessing Node Object

Node elements can be accessed by document object. In the next example we will see how to access the node element and traverse the parent and the child node elements.

For the HTML document structure shown above, I will use document object in JavaScript console to access the Node elements

Finding out different HTML elements (Nodes)

Find out how many Head nodes we have in out HTML document

Accessing Head Node

and the answer is

Number of Head Nodes

Similarly, let’s find out how many paragraph elements we have in out HTML document

Accessing paragraph element

and number of paragraph elements are:

Number of paragraph elements

Traversing DOM Nodes

In this section we will see how to traverse through Parent and Child nodes and Siblings as well. We have 2 paragraph elements in this HTML document. Let us try accessing the first paragraph element and then traverse to its sibling element.

Traversing Nodes

The above alert statement will give the following output

Identifying paragraph element

Now traversing to the Next Sibling of first paragraph element

Next Sibling of Paragraph Element

and this time alert will give the following output

Accessing Next Sibling

Similarly, we can access previousSibling, previousElementSibling to access the previous sibling nodes.