DEV Community

loading...
Cover image for SQL Tutorial Library from Career Karma
Career Karma

SQL Tutorial Library from Career Karma

arturmeyster profile image Artur Meyster ・3 min read

SQL Tutorial Library from Career Karma

Databases are absolutely everywhere. They’re used by software engineers to store data for apps and games. They’re used by web developers to store user data. They’re used by companies to manage all the data they create.

SQL is used to store data in and retrieve data from databases. If you’re new to SQL, this article is for you! We’ve compiled a list of Career Karma tutorials on SQL to help you beef up your knowledge of the database language.

What is SQL?

SQL, which stands for Structured Query Language, is a language that allows you to access the contents of and modify the values in a database. SQL is pronounced as “S Q L” or “sequel”.

SQL allows you to view data in a database, add data to a database, amend data inside a database, and manage access to a database.

SQL was invented in the early 1970s. It may be an old technology but it’s still widely used today. In fact, SQL was declared a standard by the International Organization for Standardization (ISO) in 1997. It’s still the number-one database query technology to this data.

SQL Tutorials

Create a Table

First, you’ll need to learn how to create a table in a database. A table organizes data inside rows and columns. To create a table, you can use the CREATE TABLE statement.

Create a Record

Database tables consist of records. Each record is an individual entry in a table. You can create a record by using the SQL INSERT INTO statement.

You can create a record that fills in all the column values in a database or you can create a record with some values omitted that you can set later on.

Select a Record

SQL makes it easy to select data from a table. You can use the SELECT statement to select which data you want to retrieve from a table. You can select all the columns from a table or a specific set of columns.

Using the WHERE Statement

The WHERE statement is used to select records on which a command should be run. It can be used with a SELECT statement to view records that meet a condition. It can also be used with statements like UPDATE and DELETE to select which records should be modified.

Viewing Information About a Database

Aggregate functions allow you to retrieve information about data inside a database. The SQL aggregate functions are COUNT, MIN, MAX, AVG, and SUM.

For instance, you can retrieve the average of values in a database column, or the highest record with the highest in a column.

Update a Record

The UPDATE statement modifies the contents of a record or multiple records. By default, the UPDATE statement amends all records in a database. That’s why it is often used with a WHERE statement. The WHERE statement lets you select specific records to change.

Delete a Record

What happens if you want to delete a record? That’s where the DELETE statement comes in handy. The DELETE statement can delete all records in a database or a record or set of records that meet a particular condition or list of conditions.

Commenting in a Database

You can write comments inside an SQL database. Developers use comments to keep track of their queries and commands and how they work. Comments can span over one single line or over multiple lines.

Limit a SELECT Query

A SELECT query could return hundreds or thousands of values in a large database (or even more). The LIMIT statement limits the number of records returned by a query. For example, you could return only the first 10 records when a query is run.

Check if a Value is Not Equal

The not equal operator (!=) checks if a value is not equal to another value. This allows you to select or modify records which have a column whose value is not equal to a particular value.

Conclusion

SQL may be an old technology and developers may debate over how to pronounce it. Nevertheless, SQL is still the most widely used database query technology in the world.

Learning SQL will put you on a good footing for a number of careers in technology. Whether you want to be a database administrator, a data scientist, or a web developer, knowing how to write queries in SQL is helpful.

Discussion

pic
Editor guide