Monday, January 28, 2008

Opening Database and Sending Queries

Here are the instructions on how to set up you're own practice range for SQL learning. I am going to write the instructions using Microsoft Access, because that is what I am using. You may want to use something else, especially if you're using Linux. There is a free Java based SQL client called Aqua Data Studio. It can be downloaded at http://www.aquafold.com/. If you go with that option, read up on their website about how to get started.

If you are using Microsoft Access, then read on:

You should already have the database downloaded from 2 posts ago, or find any other MS Access database online to use as a practice DB.

1. Click on the .mdb file you downloaded to open MS Access and the database. It will open with a smaller window inside that look like this:

accessscreen

Select 'Queries' from the side menu. Then click on 'New' from the top menu. In the 'New Query' popup, select 'New Design' and press OK. In the next popup, 'Show Table', press 'Close'.

Go to the 'View' menu on top, and select 'SQL View'.

view menu

In the window that opens is where you'll be doing you're magic. Access already puts in the SELECT statement because that is usually what you'll be using. When you finish typing your SQL query, you'll press the red exclamation mark on top to run it.

run button

The output will be displayed in a new window. To go back to your SQL query, you'll choose SQL View again from the 'View' menu.

Now that you have the battleground ready, let's get going.

No comments: