Menu
Coddy logo textTech

What is a database

Part of the Fundamentals section of Coddy's SQL journey — lesson 2 of 72.

Databases are like large buckets that store data in an organized manner.

Here are two examples of when we would like to create a database:

  • A database for a university to save data about students, courses, and lecturers.
  • A database for a car agency to track sales, car storage, and employees.
  • And many more

Inside a database there are tables, and each table has a name, column names, and rows.

For example, this is a workers table:

 firstnamelastnameageexp_yearsgender
1GhullyThuas292.3Female
2BostalShkolky320.2Male
3QaostuMalop214Female

The workers table has 5 data columns (firstname, lastname, age, exp_years, gender) and 3 rows. The first column (showing 1, 2, 3) is just a row number, not a data column.

We don't need any special tool to know that we have 3 workers, and it's easy to calculate the average age of all of them (29 + 32 + 21) / 3.

But what happens when we have a thousand or even a million rows?

That's where databases and SQL (Structured Query Language) come in.

SQL is a standard language designed specifically for managing and manipulating data in databases.

Databases store all of the tables, and SQL helps us extract and analyze the data we need.

To extract the whole table from the database, we need to specify which columns to SELECT and FROM which table to extract.

To do this we'll write:

SELECT column1, column2, column3 FROM table_name
challenge icon

Challenge

Easy

Available tables and columns:

  • workers: firstname, lastname, age, exp_years, gender

 

Write a query to extract the whole table (all of the columns) from the database.

Use SELECT * or list all columns explicitly to retrieve every column from the workers table.

Cheat sheet

Databases store data in organized tables with columns and rows. SQL (Structured Query Language) is used to manage and manipulate data in databases.

To extract data from a database table, use the SELECT statement with the FROM clause:

SELECT column1, column2, column3 FROM table_name

Try it yourself

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals