Databases & SQL Basics: What I Learned on Day One
Today I officially started my journey into databases and SQL. Instead of rushing into complex queries, I focused on understanding what databases actually are, how they’re managed, and how SQL is used to interact with them.
This post captures what I learned on my first day, both the concepts and the practical SQL skills.
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
Databases generally fall into two broad categories:
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. These can include:
Key-value pairs
Documents (JSON, XML)
Graphs
Blobs
They don’t use SQL, but instead rely on database-specific query languages or APIs.
Examples:
MongoDB
Firebase Firestore
Cassandra
Redis
Understanding Keys in Databases
One of the most important concepts I learned today was keys. Keys are attributes used to uniquely identify records in a table and to 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, such as: Student ID, National ID, BVN or SSNSurrogate 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
I practiced SQL using interactive exercises, and here are the key things I learned.
Selecting Data
SELECT * FROM table;
SELECT column1, column2 FROM table;
Filtering with WHERE
SELECT * FROM table WHERE field > 9;
I also learned to use logical operators like AND and OR 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 strings.
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.
Top comments (0)