SQL, or 'Structured Query Language' is a well-known, standardized programming language used to access and manipulate relational databases.
How do you say it?
It's been in use for more than 35 years, and can be pronounced either as 'sequel,' or as the acronym S.Q.L.
What's a 'relational database'?
Technically known as a relational database management system, or RDBMS, this type of database(there are others - non-relational, graph, etc.) stores multiple collections of related data entries.
The collections are called tables. Much like the tables that you can insert into a data processing document, a database table consists of columns and rows. In this case, rows are called records.
What does SQL do?
SQL can define and manipulate both tables and databases, send queries to RDBMS & retrieve the specified data, control user access privileges, and control the version of the data.
Who uses it?
SQL skills are particularly useful if you are interested in careers that focus on data science or analysis, database administration, or database design & architecture. But web developers also use RDBMS & SQL -- alongside several other programming languages -- quite often to create websites that need or produce lots of data.
Amazon's subsidiary AWS, gives an example of why SQL is popular:
[..] developers learn and use SQL because it integrates well with different programming languages. For example, they can embed SQL queries with the Java programming language to build high-performing data processing applications with major SQL database systems such as Oracle or MS SQL Server."
-- 'What is SQL (Structured Query Language)?'
What can you write with SQL?
Basic components of SQL are easy to learn due to their simplicity, and are categorized as commands, statements, queries; more complex components include stored procedures, and user-defined functions. Since this article is a simple introduction to SQL, it will not cover the more advanced components, but suffice it to say there are plenty of resources out there if you want to learn more!
Here are some simple definitions and corresponding examples of basic SQL components:
Commands - reserved keywords that communicate broad directives
CREATE TABLE; // creates a table
REVOKE james3_user; // revokes a user's access privilege
Statements - commands with additional descriptive language elements, including functions and conditionals
SET first_name = 'Gabriel'; // sets a user's first name to Gabriel
Queries - a group of statements and keywords
UPDATE User
SET first_name = 'Jabriel'
WHERE first_name = 'Gabriel'
COMMIT;
// updates the spelling of all users whose first name is Gabriel
SELECT first_name, age
FROM wagstaff_students
WHERE age < 17 && age > 15;
// selects the name and age for all students whose age between 15 and 17
How do you write it?
The main things to remember about SQL syntax are:
A semicolon always ends a command or a statement
Statements are NOT case-sensitive, although writing keywords/commands in upper-case, & column/row names in lower-case is expected
SELECT * FROM wagstaff_students;
// selects all of the contents of a table called wagstaff_students
Conclusion
I hope this article has helped you understand and appreciate the fundamentals of SQL. To summarize, SQL is a popular programming language specifically created to interact with databases that store relational data.
Because it's been around for so long, SQL can be used alongside many different front-end and back-end programming languages, as well as different open-source and corporate-owned relational database management systems.
It is useful for anyone learning full-stack web development or data structures and analysis, and is quite easy to learn considering the simplicity of its commands and statements.
Photo Credit: Photo by Mark Boss @ Unsplash
Accessible Image Description: Person leaning on fence inside building
Top comments (0)