Databases & SQL Basics: What I Learned on Day One

Published: (January 5, 2026 at 07:52 PM EST)
3 min read
Source: Dev.to

Source: Dev.to

What Is a Database?

A database is a structured collection of related data stored electronically and organized so it can be easily accessed, managed, and updated. Databases are used everywhere—by individuals, businesses, and governments. They can be as large and complex as a national citizens’ database, or as simple as a friends list, an invoice table, or a sales record.

To manage databases digitally, we use Database Management Systems (DBMS).

What Is a DBMS?

A DBMS is software that allows users to store, manage, and maintain databases efficiently and securely. Examples include:

  • PostgreSQL
  • MySQL
  • MariaDB
  • Oracle Database
  • MongoDB

A DBMS provides:

  • Data storage and organization
  • Security through access control
  • Backup and recovery
  • Easy import and export of data
  • Support for CRUD operations: Create, Read (Retrieve), Update, and Delete

Types of Databases

Relational Databases (SQL)

Relational databases store data in tables made up of rows and columns. The data is structured, and relationships between tables are clearly defined. They use SQL (Structured Query Language) to perform CRUD operations.

Examples

  • PostgreSQL
  • MySQL
  • MariaDB
  • Oracle Database

Non-Relational Databases (NoSQL)

Non-relational databases store data in formats that aren’t traditional tables, such as:

  • Key‑value pairs
  • Documents (JSON, XML)
  • Graphs
  • Blobs

They rely on database‑specific query languages or APIs instead of SQL.

Examples

  • MongoDB
  • Firebase Firestore
  • Cassandra
  • Redis

Understanding Keys in Databases

One of the most important concepts is keys, which uniquely identify records and define relationships between tables.

  • Primary Key – a unique identifier for each record in a table.
  • Natural Keys – primary keys that map to real‑world identifiers (e.g., Student ID, National ID, SSN).
  • Surrogate Keys – artificially generated keys (like auto‑incremented IDs) used when natural keys are impractical.
  • Foreign Keys – keys that reference the primary key of another table, creating relationships between tables.

SQL Basics I Learned Today

Selecting Data

SELECT * FROM table;
SELECT column1, column2 FROM table;

Filtering with WHERE

SELECT * FROM table WHERE field > 9;

Logical operators such as AND and OR can be combined to build more complex filters.

Getting Unique Values

SELECT DISTINCT field FROM table;

Counting Rows

SELECT COUNT(*) FROM table;

Using Aliases

SELECT field AS Total FROM table;

Working with Strings

SQL uses single quotes for string literals.

SELECT * FROM table WHERE name = 'John';

Pattern Matching with LIKE

SELECT * FROM table WHERE name LIKE 'T%';

String Length and Parsing

SELECT * FROM table WHERE LENGTH(name) > 3;
SELECT * FROM table WHERE LEFT(name, 1) = 'T';

Working with Numbers

Rounding Values

SELECT ROUND(value, 2) FROM table;

Finding Even Numbers Using Modulo

SELECT * FROM table WHERE MOD(id, 2) = 0;

Final Thoughts

What stood out to me today is how powerful even basic SQL queries can be. Simple SELECT statements already allow you to ask meaningful questions about data. This first day helped me build a strong foundation, and I’m looking forward to creating tables, inserting data, and designing real database structures next.

Back to Blog

Related posts

Read more »