SQL (Structured Query Language, pronounced either “sequel” or “ess-cue-el”) is a standard database language used in web programming to access and manipulate information stored in structured, relational databases. The American National Standards Institute (ANSI) has named SQL the industry standard for managing structured, relational databases. You can use this programming language to perform a variety of functions on data contained in these kinds of databases.

SQL works for managing relational databases in many different settings. So programmers, developers, and anyone who wants to manage company databases will want to learn the basics of this widely used programming language. And because SQL is an industry-standard language with a straightforward syntax, it has applications in industries of all kinds.

The Complete SQL Bootcamp 2021: Go from Zero to Hero

Last Updated October 2020

  • 83 lectures
  • All Levels
4.7 (98,692)

Become an expert at SQL! | By Jose Portilla

Explore Course

Key SQL functions include:

Who Needs to Know How to Program With SQL?

SQL can create databases for a variety of programming needs, including content management systems (CMS) like WordPress. Since SQL is so widely used, people in all kinds of web-related jobs and functions may need to be familiar with it. For the most part, programmers and those in charge of managing structured databases will use SQL regularly in a business setting. However, others might also want to learn how to do certain functions related to managing a database. Take blogging, for example. When you create a new blog on your hosting platform, the system generates a new database that stores information that you want to appear on the site, such as posts.

When a visitor reads a blog post on your site, SQL is the language used to retrieve that post from the site’s database. SQL allows the WordPress CMS and other systems to easily find and retrieve the data they need.

Many blog owners are content to use their website’s user interface rather than work with the site’s database to make changes or add content to their site because it’s user-friendly and doesn’t require much programming knowledge. However, others may want to understand how to do things like access past posts or delete multiple posts at once, and those actions require knowledge of the “behind the scenes” working of the database.

Furthermore, if you’re learning to program websites, planning to build and edit databases for your business or company, or even simply interested in how these programs work for storing and retrieving data, you may want to learn how to use SQL to add, modify, or delete records from your databases.

SQL has many other uses, too. A school might store student records in a database that uses the SQL programming language. An employer might create a database that includes all employees, their salaries, jobs, and contact information. A doctor might store information on patients or supplies purchased for the practice in a structured database. Now let’s look more closely at SQL and how it works.

SQL Syntax and Common Commands 

SQL has a relatively straightforward syntax that consists of statements, clauses, and various other operators that work together to perform precise searches and other tasks within table-based, relational databases or across multiple databases.

SQL uses a group of standard commands, or statements, to perform these functions. These statements are complete, independent strings of code that allow you to do almost everything you’ll need to create, edit, or delete data in a structured database. Most commonly used SQL statements include:

Learning more about the common SQL commands and how you would use them is a good basis for getting more proficient in working with this versatile and popular programming language. You can start getting acquainted with SQL’s basic structure and its most important commands in our article highlighting the most useful SQL commands.

This post will focus on just one of SQL’s many essential commands—the SQL DELETE statement. Deleting records manually can be time-consuming, but the DELETE statement allows you to quickly delete any record, or multiple records within a database, or even delete the entire database itself. For all these reasons, you’ll want to learn how to use the DELETE command in SQL.

Working With the SQL DELETE RECORDS Command

The default SQL command DELETE will delete records from a table in the database. The term DELETE FROM with the table name will tell the database which table to select. Used alone, it will delete an entire row, not just specific columns in the table.

To specify which data to delete, you must also add the WHERE clause. Otherwise, SQL will delete all the records from the selected database. The basic syntax for deleting specific records from a particular table with the WHERE clause looks like this: 

DELETE FROM include_table_name_here WHERE [what rows will be deleted];

This statement specifies the name of the table where data will be deleted and which exact rows are involved.

Here’s an example using a company database. Let’s assume you have a database called Employees that includes the name, position, and salary of everyone in the company. That list looks like this:

2SmithAssistant Manager75000.00
3WilliamsSales Clerk15000.00

To DELETE all rows from this database, you won’t need to use the WHERE clause because the DELETE FROM covers the entire database. Here’s how that would look:

DELETE FROM Employees;

This simple statement will delete all rows in the Employees table.

Now, if you only wanted to DELETE one employee, you’ll need to define the specific records related to that employee. Let’s suppose you want to delete the employee whose ID is number 2 in the table. In that case, you would include the WHERE clause, like this:


DELETE FROM affects only the employee whose ID is 2. Other records in the database remain the same. To remove all data from the table, you could omit the WHERE clause.

Let’s look at another example. Suppose you have a database of T-shirts, and you’ve sorted them by color. Let’s say you want to delete all records for the color red. That would look like this:


Here, we’ve specified the table “SHIRTS” and limited the SQL operation to records relating to the color “red.” Only those records will be returned and deleted in this operation.

Delete Records Without Deleting the Entire Table

In some cases, you may want to delete all the records within a database without deleting the entire database itself. In that case, there’s no need to create a table since you can keep the existing framework. For example, you might be removing all your old inventory and replacing it with new products, but you want the database to retain the same product categories, such as size, color, or price. To DELETE all the records within a table without removing the entire table, the statement looks like this:

DELETE FROM table-name;

So if the table you want to delete is named “Candles,” the statement would look like this:


Here, we’ve created a statement that deletes all records within the table named “Candles.” Once you make this change, it is permanent.

A Few More Examples

Suppose we’ve opened a business selling handcrafted items from various vendors. We’ve created a table that holds the vendors’ names, the type of item they sell, and their contact information. This table, named Vendors, might look like this:

101CharlesWood Carvings555-5555

Now, let’s suppose that Charles closes his shop, so we want to delete his entire record from the database. We can do that with a statement that targets only Charles’ shop ID:


This will delete all the information pertaining to Charles, whose ID number is 101.

Or suppose you’ve decided to stop selling candles, and you have multiple candle vendors you won’t be using anymore. You could DELETE all those records from the database with the statement:


And finally, if you shut down your shop completely and no longer need this database at all, you could delete all the records in the database with the simple command:


Again, this is a permanent action that will remove every record and delete the entire table.

The Next Steps in Your SQL Learning Path

SQL is a widely used, straightforward programming language that’s easier to learn than many others. Whether you’re aiming for a programming career, running your own website, or managing a business, it doesn’t take long to gain a basic understanding of SQL that you can use to manage all the records in your databases. To learn more about the syntax of SQL and how to work with this fast, efficient programming language, take a look at the many resources that highlight its individual statements and clauses, such as this one on the very important WHERE clause. 

Top courses in SQL

SQL and PostgreSQL: The Complete Developer's Guide
Stephen Grider
4.8 (1,423)
Highest Rated
The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert
Colt Steele, Ian Schoonover
4.6 (54,115)
Advanced SQL : SQL Expert Certification Preparation Course
Oracle Master Training • 80,000+ Students Worldwide, Code Star Academy
4.4 (2,184)
SQL for Beginners: Learn SQL using MySQL and Database Design
Tim Buchalka's Learn Programming Academy, Jon Avis - SQL Instructor
4.5 (10,930)
SQL & PostgreSQL for Beginners: Become an SQL Expert
Jon Avis - SQL Instructor
4.5 (3,198)
SQL Programming Basics
Global Academy
4.3 (98)
Oracle SQL - Step by Step SQL
Amarnath Reddy
4.4 (2,159)

More SQL Courses

SQL students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.

Request a demo