Structured Query Language (SQL) tutorial
The SQL Server database
At the simplest level, the SQL Server database consists of the following:
- A collection of tables to store the data: This is the heart of any database.
- A collection of queries designed to extract information from the data: You can create queries using the Query BY Example interface, or directly using SQL statements in the SQL Window.
- A collection of forms and reports designed to present the information in a user-friendly manner.
You will be working with the first two types of database objects: tables and queries.
SQL and the SQL Server database
During this course you will be using SQL Buddy to enter SQL queries and scripts, and to view results of the queries. SQL Buddy also has a database explorer, so you can check properties of your database objects. It can be downloaded from Source Forge . You can open SQL Buddy from the Start menu of your computer.
The Query window
Queries are typed into the right hand side editor window and the results are displayed underneath the query statement, as shown below:
You should type all SQL statements into this window. In some circumstances, you will be able to load a pre-prepared SQL script into the window using the File > Open command.
Running a query
Once you have entered a query into the SQL window, you can see the answer to your query by clicking the Run button,
, which can be found on the toolbar above the editor window.