SQL – Access and Wikipedia – quick way to learn the basics

It is quite challenging and quite not interesting to learn SQL if you are a complete beginner – after reading a lot, about installation of servers and programs many people just quit and state that it is not their thing. In this article, I will show you a really easy and practical way to learn the basis of the Standard Query Language (SQL).

You need two things:

1. MS Access (OK, it is not free but the chances that you have it at your PC are pretty high)

2. Internet access  (as far as you are reading this you have it, so you are eligible).

What I have done to start working with SQL is that I started to work with MS Access a while ago. There I have noted, that after you create the query in the old fashioned Access way, you may use SQL view in order to see the automatically generated code. And the beautiful thing about it, is that it actually works the other way around as well – if you edit the SQL view, the query is changed. Here is the SQL view in Access:Query1

 So, if you are beginners in MS Access and in SQL, but you need it, there is actually a quite quick way to learn it – Go to Wikipedia and read the article about SQL there. And try and practise while reading. The good thing about SQL is that it is REALLY Standardized and it makes sence. The word STANDARD is for a reason, indeed.

So, what I have done in the past 40 minutes was to go to wikipedia (the German version, do not ask me why) and to check whether it is doable for complete beginner to do it. And it was!

At first you should create 4 Tables as per the one in the example in Wikipedia. Their names are (hort, Professor, Student and Vorlesung). There is one small trick – do not use “Name” for a column header, because this is a special word in Access and there may be some minor issues due to this. That is why I have used “Namee”, which is not a special word anywhere.

Once you have created the four small tables, you just start making Queries. You go to Create > Queries > Query Wizard and there you select Simple Query Wizard, like in the screenshot below:

QueryWizard

 Then you just select some table and add some fields. It is absolutely irrelevant, which table and which fields you are going to select, as far as you are going to redefine the whole query through SQL later.

Q2

 So, once you have clicked on “Finish”, you go to HOME > VIEW > SQL VIEW and you simply delete the automatically generated code there and you paste the code from Wikipedia. Once the code is pasted, you click “Run Query” and you can compare your results with the results at Wikipedia. The button “Run” is located here, with a big red exclamation mark.

Run

 So, with this two things – Access and Wikipedia you can easily take over the basis of SQL, without installing some complicated database software. If you want some advanced commands, you should take a look at the forums in the internet. And if you are lazy or you just do not want to create Database Tables from Wikipedia and queries, you may take a look at my database here! Feel free to edit it or  whatever!

And by the way VBA works with Access and databases as well. Not the same way it works with Excel, but there are other interesting tricks there, which I will show later.