Trusted answers to developer questions

What is SQL?

Get the Learn to Code Starter Pack

Break into tech with the logic & computer science skills you’d learn in a bootcamp or university — at a fraction of the cost. Educative's hand-on curriculum is perfect for new learners hoping to launch a career.

Structured Query Language (SQL) is a standard data-oriented language which is primarily used to store, retrieve and manipulate data using simple code snippets, called queries, in an RDBMS (relational database management system).

The data is stored in the RDBMS in a structured way, where there exist relations between the different entities and variables in the data. These relations are defined by the database schema which does not only specify the relation between various entities but also the organization of data associated with those entities in the database.

svg viewer

SQL statements

Since SQL can be used to store, retrieve as well as manipulate the data in an RDBMS, it comes packed with many statements that are used to achieve those operations. Given is a list of some commonly used SQL statements:

svg viewer

Example

Given below is an example. You first create a table, insert some data in it and then view all the data in that table.

-- Creating a table in database
-- CREATE TABLE <Table name>
CREATE TABLE Persons (
-- <Variable name> <Variable type>
FirstName varchar(255),
LastName varchar(255),
Country varchar(255)
);
-- Inserting
INSERT INTO
-- <Table name>
Persons
-- <Variable names>
(FirstName, LastName, Country)
VALUES
-- <Variable values>
('Faysal', 'Herminio', 'Tanzania'),
('Bertha', 'Cleisthenes', 'Spain'),
('Jonatan', 'Netanel', 'United States');
-- Selecting everything we stored in the table to view
SELECT *
FROM Persons;

RELATED TAGS

sql
query
structure
database
schema
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?