MySQL Inner Join Tutorial (Including Examples)

This tutorial shows you how to write ANSI-style MySQL inner joins with the help of the INNER JOIN keywords. Included are a short introduction and some example statements.

Syntax

First of all, some examples for the impatient. In MySQL, a join condition can be specified in two different ways. Take a look at the following statements:

– inner join with USING clause

SELECT * FROM firsttable a INNER JOIN anothertable b USING(columnname)

– inner join with ON clause

SELECT * FROM firsttable a INNER JOIN anothertable b ON a.somecolumn = b.anothercolumn

Basics

A very common operation in SQL statements is the inner join. It identifies and combines only rows from related database tables when a match can be found in both tables. A condition is used to specify in which way data that is stored in the addressed tables is related. To specify the join condition, the keywords ON or USING can be used:

  • ON is used when the relationship column has a different name
  • USING is used when the relationship column has the same name in both tables

Take a look at the following examples:

– ON clause

SELECT *

FROM tableA a

INNER JOIN tableB b

ON a.someColumn = b.otherColumn

– USING clause

SELECT *

FROM tableA a

INNER JOIN tableB b

USING (columnName)

Inner Join, Cross Join and Join

In MySQL, the keywords CROSS JOIN AND JOIN are synonymous with the keywords INNER JOIN. The ANSI SQL standard describes a CROSS JOIN as a join without a condition. It’s the Cartesian product of two tables and called a cross join. In MySQL it’s simply an inner join without a condition. The result set is the Cartesian product of these tables.

When you want MySQL to build the Cartesian product of two tables, use the CROSS JOIN keywords to indicate that intension. It makes it more easy to read your statement and keeps your code portable between different relational database management systems (RDBMS) such as Oracle or Postgres.

More than one join

It’s also not uncommon to combine more than one table with a single statement. And there is nothing special about it. You only have to add joins and (most probably) conditions:

– more than one

SELECT *

FROM tableA a

INNER JOIN tableB b

ON a.someColumn = b.otherColumn

INNER JOIN tableC c

ON b.anotherColumn = c.nextColumn

MySQL then creates a large result set in two first steps. The first step is to combine rows from tableA and tableB. In the second step rows from tableB and tableC are combined.

Posted in Uncategorized | Leave a comment

Cobol, the Aging Language That Won’t Go Away

Cobol stands for COmmon Business-Oriented Language. This is a programming language that has been around since the early 60′s. Yet, it is still used by a lot of huge businesses. Why would businesses stick with Cobol when there are plenty of newer and more powerful object oriented languages?

One reason is that to rearchitecture an entire system is very costly. Think about it, you would need to hire programmers who are knowledgeable about Cobol and the language the code will be “translated” to. These programmers are hard to find and won’t come cheap!

If it works then don’t fix it. This is a very true and makes complete sense. Upgrading does a few things; it could increase speed, fix bugs and even be more efficient. Some companies are very content with Cobol and there is really nothing wrong with it. Therefore, it is kept.

Can learning Cobol still be beneficial? Absolutely! Many big businesses that still use Cobol are seeing a very interesting and troublesome problem. Most of their Cobol programmers are getting to the point of retirement. So, hire new ones! Therein lies a problem with this, most colleges to don’t teach Cobol anymore, they have moved on to newer and better languages.

It is definitely smart for college students in the Computer Science field to learn Cobol. This language can help them in finding a job with ease after graduation. Many companies look for younger college students who know Cobol. By taking a course or just learning it on your own, you can separate yourself from all the other Computer Science majors. That difference or separation would be that you know Cobol and they don’t.

Cobol is very similar and very different from your newer languages. Cobol allows you to do a lot of the same things that Java and C++ programmers are used to. You still get loops, if statements and variable declarations. The difference is that it is simply done a different way. You don’t use the int word to declare an integer; you use a PIC 9 clause instead. It is very confusing and weird at first, but becomes second nature after a while.

Pick up a book or take a course on Cobol I promise it will come in handy at some point. If anything it will be a great addition to your resume. Cobol programmers are becoming hard to find. The language itself is over 50 years old and is here to stay. Do your homework, search for companies that still use Cobol on their mainframes. I bet you will be surprised!

Posted in Uncategorized | Leave a comment

The Advantages of Working With a Software Boutique Company

First of all, a boutique is a small shop where clients can find dedicated merchandise and unique items, or products which are produced in small quantities. The advantage of entering in such a shop, compared to big supermarkets, is that here you’ll also find staff ready to assist you and to give you guidance step by step. Indeed, one may say that a boutique charges higher prices, also in comparison to chain stores, which is definitely true. However, once you bought something from a boutique you’ll have the feeling that you own a unique item, which will differentiate you from the rest, and isn’t this what we all want – to be unique?

Software boutiques are a new way of defining petite software companies which are focused on a certain niche, and which are able to offer specialized support to their customers. Even more, such a firm is able to offer a unique product, tailored on the client’s needs and requirements. But, let’s see what advantages does a customer have when collaborating with a software boutique company:

Tailored product
A software boutique takes the client’s specifications and transforms them into a customized piece of software. Practically, if you are not satisfied by the mass-produced software programs which you can find, then a boutique company will tailor a product according to each and everyone of your requirements. The outcome will be a software product which is able to fit perfectly your company’s needs.

Niche focus
Generally, a boutique company is focused on a certain niche, for example developing applications and software products using Microsoft technologies. The advantage of having such a partner, is that you’ll have the confidence that he has the knowledge and proven experience to offer you the best advices regarding that specific area, and that he’s always updated with the latest technologies.

Crystal clear communication and dedicated support
Having a smaller amount of projects, a boutique software company can offer its clients dedicated support, according to every client’s need through a direct communication flow. This means that the information won’t need to travel through several departments until it reaches you, so that you’ll always be updated with the status and the quality of the work.

A good communication, not only that can save time, but also can make the development process more efficient. For example if you want a specific functionality for your application, collaborating with a boutique firm, you’ll able to keep track of the development process and promptly interfere in the development process if the work isn’t going in the desired direction, or if you want to change the approach. Also, fewer the clients, better the support. Practically, a software boutique will offer you their entire attention and expertise, whenever this is required.

Every client is important
For a boutique company every client is important, and because they can’t afford to lose a client, they can’t really afford to do a bad job. Every development project is treated with care, and you’ll know for sure that your project will be handled by the best men.

Posted in Uncategorized | Leave a comment

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Posted in Uncategorized | 1 Comment