DBMS, SQL, PL/SQL & MongoDB Medium Notes
DBMS Introduction
- DBMS manages data efficiently.
- RDBMS stores data in relational tables.
- Primary Key: Unique identifier of record.
- Foreign Key: Links two tables.
Basic SQL Commands
- CREATE DATABASE: Creates a new database.
- CREATE TABLE: Defines structure.
- INSERT INTO: Adds records.
- SELECT: Retrieves data.
Where, Like, Between
- WHERE: Filters rows.
- LIKE: Pattern match.
- BETWEEN: Range filter.
SQL Joins
- INNER JOIN: Returns matching records.
- LEFT JOIN: Returns all from left table.
- RIGHT JOIN: Returns all from right table.
Group By, Having, Aggregates
- GROUP BY organizes rows.
- HAVING filters grouped results.
- COUNT, SUM, AVG, MIN, MAX commonly used.
Views & Index
- VIEW: Virtual table.
- INDEX: Improves search performance.
PL/SQL Basics
- DECLARE-BEGIN-EXCEPTION-END structure.
- IF and LOOP for logic control.
PL/SQL Exception Handling
- NO_DATA_FOUND handles empty result.
- RAISE_APPLICATION_ERROR creates custom errors.
Cursor
- CURSOR used for row-by-row processing.
Trigger
- TRIGGER executes automatically before or after DML.
MongoDB Basics
- use db selects database.
- insertOne() adds document.
- find() retrieves documents.
MongoDB Update/Delete
- updateOne() modifies documents.
- deleteMany() removes documents.
MongoDB Aggregation
- aggregate() performs group operations.
- MapReduce handles large-scale aggregation.