Beginner’s Guide to SQL Querying

Learn SQL with Udemy

For an instructor lead, in-depth look at learning SQL click below.


If you’re new to SQL (Structured Query Language), it might seem a bit daunting at first, but don’t worry – with some practice, you’ll quickly get the hang of it. Here, we will walk through the basics of SQL querying.

What is SQL?

SQL (Structured Query Language) is a programming language used to communicate with and manipulate databases. Most of the actions you need to perform on a database are done with SQL statements.

Getting Started

Before you start, you should have a database software installed on your computer. You could use MySQL, SQLite, PostgreSQL, or Microsoft SQL Server. For this guide, we’ll use MySQL because it’s widely used and open source.

Connecting to a Database

First, you will learn how to connect to a database. You will use the MySQL command-line tool.

The -u flag specifies the user (in this case, root), and the -p flag tells the system to issue a prompt for a password.

Creating Tables

Let’s start by creating a table in our database. Here’s how to create a table named ‘users’ with columns ‘id’, ‘name’, and ’email’.

Inserting Data

Now that we’ve created a users table, let’s insert some data into it.

Selecting Data

To retrieve the data you’ve just inserted, you’d use a SELECT statement, like this:

Updating Data

If you need to update records in your table, you can use an UPDATE statement. Here’s how you would change John’s email:

Deleting Data

To delete data from your database, you can use a DELETE statement. Here’s how to delete Jane Doe:

Congratulations! You have now learned the basics of SQL querying! Though this is just the tip of the iceberg, these are the most commonly used SQL commands, and they are enough to do a great deal of database work.

Leave a Comment