2. Where to run your SQL

This very brief lesson is to show you how to use SqlFiddle.com…a FREE online application you are going to be using in order to execute (run) the SQL code you will be learning.

Table of contents
  1. SqlFiddle.com – the (FREE) Application
  2. How to use SqlFiddle.com
  3. SqlFiddle.com…how it works
  4. Running your first bit of SQL code 🙂 !
  5. Summary
1. SqlFiddle.com – the (FREE) Application

In order for you to practise your SQL, you will need somewhere to run it! I have chosen a very simple, and FREE, application for you to do that on, called SqlFiddle.com. The best thing with this application, is that you do NOT need to learn all about running a Database Management System (DBMS)!

As with most other SQL Tutorials, I could have had you download and install a full DBMS to practice things on, but that would be very involved and would defeat the object of this tutorial…a simple tutorial to just show you the basics and hopefully build your confidence for you to move on to bigger and better things 🙂 !

back to table of contents

2. How to use SqlFiddle.com

This lesson will introduce you (gently) to running some SQL, by doing something that you would not normally be asked to do as a Test Analyst…you’re going to create a simple Database Table. However, once you’ve created the table, you will be able to run your first SELECT statement so as to retrieve the data you’ve created…exciting 🙂 !

To do this, you will be:

  • Visiting a FREE website where you can run and practice your SQL
  • Cutting and pasting some SQL for you to create a table and some data
  • Retrieving (by executing a SELECT Statement) data from the table to see the data you created

Again, this very brief lesson is to show you how to use SqlFiddle.com…an online application. So let’s have a real quick play with it by running some SQL.

I don’t want you to try to understand the SQL you are running! You are simply getting used to using SqlFiddle.com 🙂 .

back to table of contents

3. SqlFiddle.com…how it works

This app is very simple to use:

  • There are 2 panes, one on the left and one on the right
  • The Left Hand Pane lets you create tables for you to test against. It also allows you to insert data into the tables…don’t worry, I will be giving you the code to do that
  • Once the table(s) and data are set up, you then use the Right Hand Pane to write and execute (run) your SQL statements…easy 🙂 !

As a Test Analyst, you are not expected to manage a Database System…like creating tables! In all the big corporate companies, there is a specialist team (Database Administrators aka DBAs) who set up the database, create the structure and the tables and generally maintain it to keep it running smoothly.

Important things to note about using SQL Fiddle: 

  • The Tables you will be creating will not be permanent. They are deleted once you close the page OR you change the table layout (which is known as a Schema)
    •  Is this a problem? No…not at all. You are, after all, just attempting to practise your SQL, which you do in the Right Hand Pane of SqlFiddle.com
  • If you experience any problems, just click on “Clear” and cut and paste the Schema again in the Left Hand Pane and click Build Schema
  • By all means, once you’re up and running…have a play with the application. See what the other buttons do…you honestly cannot break anything!

back to table of contents

4. Running your first bit of SQL code 🙂 !

Open the SqlFiddle online application, click here SqlFiddle.com

Create your first Table and some data:

  1. Ensure the default DBMS is set to MySql (which is the database system we are using for this tutorial) at the top of the application:
  1. Copy the code below: 
CREATE TABLE account (
  account_name VARCHAR (30) PRIMARY KEY,
  account_desc VARCHAR (100) NOT NULL,
  account_start_date DATE NOT NULL,
  account_end_date DATE
  )
;
INSERT INTO account
VALUES 
('VISA', 'visa ACCT', '2022-01-01', NULL)
,('CurrentAccount', 'Current Account', '2022-01-01', NULL)
,('SavingsAccount', 'Savings Account', '2022-01-01', NULL)
;
  1. Paste the code into the Left Hand Pane in SqlFiddle:
  1. Click the Build Schema button. You should now see the following, which means your table and data are ready:


Now…let’s run our first SQL Statement:

  1. Copy the following code:
SELECT * 
FROM account
;

  1. Paste the code into the Right Hand Pane:

Click the Run SQL button and you should now see the results:

Woo hoo…your first execution of SQL!

back to table of contents

5. Summary

As mentioned in section 1.1, I am not after you knowing too much about databases. At this stage I want you to know just enough so as to be able to learn SQL…how to retrieve data from a database.

That is the beauty of using SqlFiddle.com, it allows you to concentrate on the Right Hand Pane (running SQL statements) and not the Left Hand Pane (used to create a test Table to practice your basic SQL) 

So, you have now not only worked out how to use the Application that will run your practice SQL, but you have also created some SQL and executed it to get some data back!

In this section, you will have learned:

  • You do not need to understand the workings of a DBMS to learn SQL
  • How to use an application that runs just SQL

back to table of contents


Prev lesson ⇒ 1. Intro to Beginners SQL

Next lesson ⇒ 3. Database Basics