Data vs. Information
Data is a collection of raw facts and figures that have no meaning on their own. Examples of raw data:- Rahul
- 25
- ₹50,000
- Hyderabad
This table is information — you can now see that Rahul is an employee who earns ₹50,000.
Practice: Data vs. Information
Practice: Data vs. Information
Which of the following is an example of raw data?
- A. Rahul
- B. 25
- C. ₹50,000
- D. All of the above
What Is a Database?
A database is an organized, electronic collection of related data that can be accessed, updated, and managed efficiently. Examples you encounter every day include:- Student Management Systems
- Banking Systems
- Hospital Management Systems
- E-commerce Inventory Systems
- Library Management Systems
What Is a DBMS?
A Database Management System (DBMS) is software that sits between your application and the stored data. It handles creating, reading, updating, and deleting records while enforcing rules, controlling simultaneous users, and providing backup and recovery. Popular DBMS products include:- SQLite — lightweight, serverless, embedded
- MySQL — widely used for web applications
- PostgreSQL — open-source, feature-rich
- Oracle Database — enterprise-grade
- Microsoft SQL Server — Windows ecosystem
Advantages of Using a DBMS
Compared with raw files or spreadsheets, a DBMS gives you:- Faster data retrieval
- Reduced data redundancy
- Better security and access control
- Data consistency across multiple users
- Concurrent (simultaneous) access
- Automated backup and recovery
- Easier long-term maintenance
Types of Databases
Relational Databases (SQL)
A relational database stores data in tables made up of rows and columns. Every table represents one type of entity (e.g., employees, departments), and tables can be linked together through shared key columns.NoSQL Databases
NoSQL databases store data in formats other than tables — documents, key-value pairs, graphs, or wide columns. They sacrifice some structure in exchange for flexibility and horizontal scalability.SQL vs. NoSQL at a Glance
What Is SQL?
SQL (Structured Query Language) is the standard language for communicating with relational databases. Using SQL you can:- Create and modify table structures
- Insert, update, and delete records
- Query and retrieve data
SQL is not case-sensitive for keywords (
SELECT and select are equivalent), but it is a widely adopted convention to write SQL keywords in uppercase.Relational Database Concepts
Tables, Rows, and Columns
A table stores related information. Each row (record) represents one complete entity, and each column (field) represents one attribute.
Here,
Employee ID, Name, and Salary are columns. Each row describes one employee.
Primary Key
A Primary Key uniquely identifies every row in a table. It must be:- Unique across all rows
- Never NULL
- Only one per table
Employee ID is the primary key — no two employees share the same ID.
Foreign Key
A Foreign Key links one table to another by referencing the primary key of a second table. This is how relational databases represent relationships between entities. Department table:
Employee table (with foreign key):
Department ID in the Employee table is a foreign key pointing to the Department table.
Practice: Primary vs. Foreign Key
Practice: Primary vs. Foreign Key
Can two rows have the same Primary Key value?No. A Primary Key must always be unique. If two rows shared the same primary key, the database would have no reliable way to tell them apart.What does a Foreign Key reference?A Foreign Key always references the Primary Key of another table, creating a verifiable link between the two tables.
Database Relationships
Relationships describe how records in one table relate to records in another.One-to-One (1:1)
One employee has exactly one passport.One-to-Many (1:N)
One department contains many employees — the most common relationship type in relational databases.Many-to-Many (M:N)
Many students can enroll in many courses. This requires a junction table to resolve the relationship.Sample Database Used Throughout This Course
All SQL examples in the following chapters use these two tables. Take a moment to familiarize yourself with them now. Department:
Employee:
Employee ID is the primary key of the Employee table. Department ID in the Employee table is a foreign key referencing the Department table’s primary key.
The next page covers SQLite, DDL, and DML — you’ll learn how to create these tables yourself and insert all the sample rows.