This is a clean study-notes HTML version. Original PDF pages are intentionally not included.
1. What is Data?
Data is information that is collected, stored, and processed. It may be represented as numbers, words, images, or other forms of information.
Data can describe people, places, things, or events. It is widely used in business, science, technology, and social sciences to understand patterns, trends, relationships, support decision-making, and drive innovation.
2. What is a Database?
A database is a collection of structured data or information stored in a computer system so that it can be accessed and managed efficiently.
A database is usually managed by a Database Management System (DBMS).
3. What is NoSQL?
NoSQL refers to non-relational databases that store data in forms other than the traditional relational table structure. The term is commonly expanded as “Not only SQL.”
The notes classify major NoSQL models as:
- Document-based
- Key-value
- Wide-column / column-oriented
- Graph-based
4. Types of Databases
| Database Type | Basic Idea |
|---|---|
| Hierarchical | Data is organized in levels or ranks, generally following a parent-child structure. |
| Network | Extends the hierarchical idea by allowing a child record to associate with multiple parent records. |
| Object-Oriented | Stores information in a form that can be represented as objects and object instances. |
| Relational | Stores related data using tables, rows and columns, with records identified by keys. |
| Cloud | Provides database storage and processing through cloud environments. |
| Centralized | Stores and maintains the database at a single location. |
| NoSQL | Uses non-tabular models such as documents, key-value pairs, columns and graphs. |
| Operational | Designed to support day-to-day operational data processing and transactions. |
5. Hierarchical Databases
A hierarchical database organizes data into levels or ranks. Data is categorized around common points of linkage, producing a tree-like parent-child structure.
The important idea is that lower-level records are connected to a higher-level parent according to the hierarchy.
6. Network Databases
A network database can be viewed as an extension of the hierarchical model. Unlike a strict one-parent hierarchy, child records can be associated with multiple parent records.
This creates a network of linked records rather than a simple tree.
7. Object-Oriented Databases
An object-oriented database stores information in a way that can be represented as objects, similar to the Object-Oriented Programming paradigm.
- Data can be represented as objects.
- An object can represent an instance of a database model.
- Objects can be referenced directly.
- The object-oriented representation can reduce the work required to map application objects to database data.
8. Relational Databases
A relational database stores data in related tables. It is one of the most widely used and mature database models.
Relationships between pieces of information are established using records and keys. A relational database typically represents data using tables, rows and columns.
| Concept | Meaning |
|---|---|
| Table | Collection of related records. |
| Row / Record | One complete data entry. |
| Column | An attribute describing a type of data. |
| Key | Used to identify records or establish relationships. |
9. Cloud Databases
A cloud database is used when data storage and database processing are provided through a virtual/cloud environment.
Cloud computing services commonly discussed in the notes include:
| Model | Full Form | Basic Idea |
|---|---|---|
| IaaS | Infrastructure as a Service | Provides infrastructure resources. |
| PaaS | Platform as a Service | Provides a platform/environment for applications. |
| SaaS | Software as a Service | Provides software as a service. |
For an on-premises application, the organization owns and manages the required hardware and software.
10. Centralized Databases
A centralized database is stored, located and maintained at a single central location.
Users access the centrally maintained data rather than maintaining separate copies at multiple locations.
11. Types of NoSQL Databases
12. Document-Based Databases
A document-based database is a non-relational database that stores information as documents instead of traditional rows and columns.
Documents may use formats such as:
- JSON
- BSON (Binary JSON)
- XML
Examples mentioned in the notes include MongoDB, Amazon DynamoDB and Azure Cosmos DB.
13. Key-Value Stores
A key-value store is a simple NoSQL model in which each data element is represented as a pair consisting of a unique key and its associated value.
The value may be a simple type such as a string or number, or a more complex object.
Key features
- Simplicity
- Scalability
- Speed
Examples
Couchbase, Amazon DynamoDB, Riak, Aerospike, Berkeley DB and Redis.
14. Column-Oriented Databases
A column-oriented database stores data by columns rather than primarily by rows. This can be useful for analytical workloads where only a small number of columns need to be read from a large dataset.
Key features
- Scalability
- Compression
- High responsiveness
Columnar databases are designed to efficiently process and retrieve large amounts of data, particularly for analytics.
Examples
Snowflake, Google BigQuery, ClickHouse, TinyBird, Apache Druid and Apache Pinot.
15. Graph-Based Databases
A graph database focuses on relationships between data elements. Data is represented using nodes, while connections between nodes are represented as links/edges/relationships.
Key features
- Relationships can be identified directly through links.
- Queries can return relationship-oriented results efficiently.
- Performance depends strongly on the number and structure of relationships.
- Adding nodes or edges can be straightforward without major schema changes.
Examples
AllegroGraph, Amazon Neptune, AnzoGraph DB, ArangoDB, JanusGraph, MarkLogic, RedisGraph, SAP HANA, TypeDB and TigerGraph.
16. Apache Cassandra
Apache Cassandra is an open-source NoSQL database designed for handling large-scale data in a highly scalable and distributed environment.
- Can handle structured, semi-structured and unstructured data.
- Was originally developed at Facebook.
- Was open-sourced in 2008.
- Became a top-level Apache project in 2010.
- Uses Cassandra Query Language (CQL) for database operations.
- Is designed as a highly scalable, distributed database.
The notes also connect Cassandra with the CAP theorem: Consistency, Availability and Partition Tolerance.
17. Cassandra Query Language (CQL)
CQL is used to perform database operations in Apache Cassandra, including creating keyspaces and tables, inserting data, deleting data and selecting data.
18. Step 1 — Create a Keyspace
Use the following CQL statement to create a keyspace:
CREATE KEYSPACE Emp
WITH replication = {
'class': 'SimpleStrategy',
'replication_factor': '1'
};
A keyspace is the top-level namespace used to organize Cassandra tables and related database objects.
19. Step 2 — Use a Keyspace
After creating a keyspace, select it using the USE command.
USE keyspace-name;
USE Emp;
20. Step 3 — Create a Cassandra Table
Once the keyspace is selected, create the table using CQL.
CREATE TABLE Emp_table (
name text PRIMARY KEY,
Emp_id int,
Emp_city text,
Emp_email text
);
Here, name is defined as the primary key.
21. Step 4 — Insert Data
Insert employee information into the table with an INSERT statement.
INSERT INTO Emp_table
(name, Emp_id, Emp_city, Emp_email)
VALUES
('smamilla', 1001, 'Hyderabad',
'sssvt.srikanth@gmail.com');
22. Complete Cassandra Flow
Example
CREATE KEYSPACE Emp
WITH replication = {
'class': 'SimpleStrategy',
'replication_factor': '1'
};
USE Emp;
CREATE TABLE Emp_table (
name text PRIMARY KEY,
Emp_id int,
Emp_city text,
Emp_email text
);
INSERT INTO Emp_table
(name, Emp_id, Emp_city, Emp_email)
VALUES
('smamilla', 1001, 'Hyderabad',
'sssvt.srikanth@gmail.com');
23. Quick Revision
| Topic | Remember |
|---|---|
| Data | Information that can be collected, stored and processed. |
| Database | Organized collection of data managed for efficient access. |
| DBMS | Software used to manage databases. |
| NoSQL | Non-relational database approach; “Not only SQL”. |
| Hierarchical | Level-based parent-child organization. |
| Network | Allows records to have multiple parent relationships. |
| Object-oriented | Represents data as objects. |
| Relational | Uses related tables, rows, columns and keys. |
| Cloud | Database services provided through cloud environments. |
| Centralized | Database maintained at one central location. |
| Document | Stores JSON/BSON/XML-like documents. |
| Key-value | Stores unique keys with associated values. |
| Column-oriented | Stores/processes data by columns, useful for analytics. |
| Graph | Uses nodes and relationships/edges. |
| Cassandra | Distributed, scalable NoSQL database using CQL. |
| CQL | Cassandra Query Language. |
| Keyspace | Top-level Cassandra namespace for organizing tables. |