Skip to content

Notes on science, software and the craft of support

Martin EvansNotes and resources

Databases

What SQL can do

SQL queries, modifies and protects data, with joins, subqueries, transactions, triggers, views and stored procedures under one language.

SQL is a powerful language used in almost every database program. It is a language for retrieving and modifying data from a database. It has been around since the 1970s and is still widely used today.

The most basic feature of SQL is the ability to query data from a database. Queries can filter and sort data, join two or more tables together and perform calculations. SQL also has features such as subqueries, which allow you to query data from multiple tables at once, and stored procedures, which allow you to store and reuse SQL code.

Changing and protecting data

Another important feature of SQL is its ability to create and modify data in a database. It is possible to create tables, modify existing tables and delete data. It is also possible to insert new rows into tables, update existing rows and delete rows. These features allow you to maintain the data in the database.

SQL also manages transactions. Transactions are changes made to the data in the database. If a transaction fails, SQL can roll back the changes to the previous state. This feature helps ensure the integrity of the data. SQL can also create and maintain triggers. Triggers are code that is executed when a certain event occurs in the database. They can be used to update data automatically or run certain operations when conditions are met.

Finally, SQL has features such as views, which allow you to create custom views of your data, and stored procedures, which allow you to store and reuse queries. These features allow you to customise and optimise a database for various tasks. SQL remains a powerful language for querying, creating and modifying data, managing transactions and creating triggers, and its features are used in almost all database programs.