Introduction to Databases
A database is like a digital filing cabinet where we store all sorts of information in an organized way, making it easy to find and use when we need it. We need databases because they help us keep track of everything from our shopping lists and favorite songs to important customer information for businesses, making sure nothing gets lost or forgotten.
With this little understanding of databases, you might be asking why do we need databases? Businesses use databases to manage everything from customer information and inventory levels to employee records and financial transactions. They help in making informed decisions by providing quick access to important data.
Types of Databases
While considering a database, we need to first understand the structure of the data we want to store in it. Broadly, most data falls into one of these 3 categories...
structured
semi-structured
unstructured
Subsequently, the type of data category determines what type of databases will be suitable for our use cases. Generally, databases are of 2 types - relational and non-relational.
Database Terminologies
Just like every other tools, there are certain terms or keywords that are associated with databases. To have a decent idea of how databases work, these terms need to be clearly understood. The common ones are given below...
1. Tables
Think of a table as a spreadsheet where data about a particular category is stored. For example, a Person
table might store information about persons as depicted below.
2. Rows and Columns
Each row (record) in a table represents a unique piece of data, like a single customer. Columns (fields) represent the attributes of that data, such as name, email, and phone number.
3. Schema
A schema is the blueprint of a database that defines how data is organized, including the tables, fields, and relationships between tables. For example, the schema belows defines how 4 different table are organised and linked together.
👩🏾🎨 Practice: Draw your Pets table
The following are the TODOs...✍🏾
- Draw a simple table for a
Pets
database. - Use pet_id, name, pet_type (e.g., dog, cat), and owner_id as columns.
- Use Tldraw or other drawing tools.
- Upload the drawing/sketch to Padlet below.