Lesson 3
Beginner Level
3 of 30 lessons
Basic SQL Syntax
SQL (Structured Query Language) follows a specific structure to perform operations such as retrieving, inserting, updating, and deleting data in a database. Knowing the correct syntax is essential to writing valid queries that Oracle can interpret.
Understanding SQL Syntax
SQL (Structured Query Language) follows a specific structure to perform operations such as retrieving, inserting, updating, and deleting data in a database. Knowing the correct syntax is essential to writing valid queries that Oracle can interpret.
General SQL Syntax
SELECT column1, column2
FROM table_name
WHERE condition;
Here's a breakdown:
SELECT— specifies the columns you want to retrieveFROM— identifies the table to queryWHERE— (optional) filters the results based on a condition
Example
SELECT first_name, last_name
FROM employees
WHERE department_id = 90;
This query fetches the first and last names of employees who work in department 90.
Practice Task
- Write a SQL query to retrieve all columns from the
departmentstable. - Try writing a query that selects
job_idandsalaryfrom theemployeestable. - What happens if you forget the
FROMclause?