We use SQL (Structured Query Language) to communicate with the data that drives the modern world. SQL is a necessary first step if you want to develop apps, examine business performance, or work as a data scientist. But it can be frustrating to get started. Before you can write your first line of code, you are frequently instructed to download database software, configure servers, and create user accounts.
Ignore all of that! Oracle Live SQL, a free browser-based environment that requires no installation, is what we’re learning with today. With pre-loaded tables for practice, it provides you with immediate access to an actual, functional Oracle database. This means you can skip the setup headaches and dive straight into querying. By the end of this tutorial, you’ll be able to log in, navigate the interface, and write your first fundamental SQL queries using the core commands: SELECT, FROM, and WHERE.
Getting started takes just a minute.
The Live SQL environment is split into three main, user-friendly areas:
The availability of Sample Schemas (such as SCOTT and HR for Human Resources) is a potent feature of Oracle Live SQL. These are pre-loaded sets of dummy data-filled tables (e.g., departments, employees). This is revolutionary! You can begin querying actual, structured data right away without having to spend time creating tables. For all of our examples, the employees table from the HR schema will be used.
These two commands must appear at the beginning of every SQL query. They make up the fundamental framework of data retrieval, known as Data Query Language (DQL)..
The SELECT command tells the database which columns (data fields) you want to retrieve.
Syntax 1: Selecting All Columns (SELECT *) The asterisk (*) is a wildcard that means “return every column in the table.” This is great for exploration.
-- Select all columns from a table
SELECT *
Syntax 2: Selecting Specific Columns To be more precise and efficient, you list the column names you want, separated by commas.
-- Select specific columns from a table
SELECT first_name, last_name, salary
The FROM command tells the database which table contains the data you want.
Example: If we want data from the employees table:
-- Specify the table to select data from
FROM employees;
There are always two clauses in a complete query: SELECT and FROM. The semicolon (;), which marks the conclusion of your SQL statement, is crucial.
Live Example 1: View everything in the table
-- Select all columns from the employees table
SELECT *
FROM employees;
(Try typing this into the Live SQL editor and clicking ‘Run’.)
Live Example 2: View only specific employee details
-- Select specific columns from the employees table
SELECT employee_id, last_name, salary, hire_date
FROM employees;
This query is much cleaner and faster because it only retrieves the necessary columns.
A table’s rows are all returned by the SELECT and FROM clauses. You hardly ever need every row in real-world analysis. The WHERE clause is used to filter the results.
WHERE clause allows you to specify a condition that must be met for a row to be included in the results. It always follows the FROM clause.
SQL uses standard comparison operators to define filtering rules:
| Operator | Meaning | Use Case |
|---|---|---|
| = | Equals to | Find employees in department 50 |
| > | Greater than | Find salaries above $10,000 |
| < | Less than | Find employees hired before a certain date |
| <> | Not equal to | Exclude employees in department 100 |
Here, we find all employees who work in Department 50:
-- Select last_name and department_id for department 50
SELECT last_name, department_id
FROM employees
WHERE department_id = 50;
And here, we find employees who earn a higher salary than $10,000:
-- Select last_name and salary for employees earning more than 10000
SELECT last_name, salary
FROM employees
WHERE salary > 10000;
When comparing text values (strings), you must enclose the text in single quotes (‘ ‘).
-- Select first_name and job_id for employees with job_id 'IT_PROG'
SELECT first_name, job_id
FROM employees
WHERE job_id = 'IT_PROG';
You can combine multiple conditions using the logical operators AND and OR to create highly specific filters.
This query finds employees in department 80 AND who also earn less than $10,000:
-- Select all columns for employees in department 80 with salary less than 10000
SELECT *
FROM employees
WHERE department_id = 80 AND salary < 10000;
Well done! You quickly learned how to use a professional database tool and became proficient in the three most basic SQL commands: SELECT (what you want to see), FROM (where the data is), and WHERE (how to filter it). Officially, you are making a database query!
Now that you have the basic building blocks, the real fun begins. Here is your learning path for continuing your SQL journey in Oracle Live SQL:
If you are ready to manipulate data, the next logical step is Data Manipulation Language (DML) commands like INSERT, DELETE, and UPDATE. If you want to move beyond the sample data, you will need to learn Data Definition Language (DDL) to structure your own tables. Get started here with creating SQL tables.
Return to your SQL worksheet and attempt to use a different operator to filter the employees table. For example, find all employees who are not in department 50 (department_id <> 50). Doing is the best way to learn SQL!
Oracle Live SQL is a free, browser-based environment that provides instant access to a working Oracle database, allowing users to practice SQL (Structured Query Language) without any local installation or complex setup.
No. Oracle Live SQL is a completely browser-based tool and requires zero installation. You only need a free Oracle account to sign in and begin querying immediately.
After signing in, navigate to the “SQL Worksheet” tab. This is the editor where you type your SQL statements and use the “Run” or “Execute” button to send your code to the database for processing.
The three most fundamental SQL commands for retrieving data (DQL) are SELECT (specifies the columns you want), FROM (specifies the table the data lives in), and WHERE (filters the rows based on specific conditions).
The semicolon (;) is critical in SQL because it signals the definitive end of your complete SQL statement. You must use it to terminate a command before you execute it.
The asterisk (*) is a wildcard used in the SELECT clause that instructs the database to return every single column from the specified table.
You filter the rows returned by an SQL query using the WHERE clause. The WHERE clause always follows the FROM clause and allows you to specify a condition (e.g., salary > 10000) for the data.
Get free consultation for your digital product idea to turn it into reality!
Get Started