What is SQL?

SQL or Structured Query Language is a scripting language used to program and interact with a relational database. Using SQL you can create, manipulate, delete databases as well as add, remove, edit, and update tables in the database and data within those tables. SQL is not the only scripting language that you can use when interacting with databases, just like relational databases are not the only type of databases that can be created.

You can either use SQL within a terminal directly connected to the database or within the code of a different programming language to run a process on the database. For example, you could write SQL scripts within PHP or Java to run processes on a relational database in response to an event or action such as a user pressing a button on the front end.

A database is basically a collection of tables that are linked together. Imagine an excel spreadsheet that contains a table of people, another table that contains address information, another table that contains contact information, etc. Then you can have different columns on each table, such as the names of the people, their phone numbers in the contact table, etc. You can also have unique ids for each person, address, and contact information (each row on each table). Then you can use the unique id to link information, for example, the people table has a column called ‘addressId’ with contains the ‘id’ value of their address in the address table.

The below code snippet shows a small piece of SQL code that will return all the rows and data within the ‘Customers’ table on the database. The ‘*’ asterisk is used to select all columns within the table of the database table.

SELECT * FROM Customers;

This post explained what SQL is and the basics of what a database is but there is so much more to databases and how to interact with them. There are non-relational databases, there are many different functions and ways to write SQL code to run many different operations within the database.

1 thought on “What is SQL?

Leave a Reply