1.
Differences between DBMS and RDBMS
DBMS:
- Manages data as files or tables
- No relationships among tables
- No support for normalization
- Less secure
- Examples: File System, XML
RDBMS:
- Manages data using relational tables
- Supports relationships using foreign keys
- Uses normalization to reduce redundancy
- More secure
- Examples: MySQL, Oracle, SQL Server
2. Database and DBMS with Types
Database: A collection of organized data.
DBMS: Software for managing and interacting with databases.
Types:
1. Hierarchical
2. Network
3. Relational
4. Object-Oriented
3. Advantages of DBMS
- Redundancy control
- Data integrity & security
- Abstraction
- Backup & recovery
- Multi-user access
- Data consistency
4. DBMS Languages
- DDL: CREATE, ALTER, DROP
- DML: SELECT, INSERT, UPDATE, DELETE
- DCL: GRANT, REVOKE
- TCL: COMMIT, ROLLBACK, SAVEPOINT
5. Query Optimization
Choosing the most efficient query execution strategy to minimize time and resources.
6. NULL vs Blank vs Zero
NULL: Unknown/missing
Blank: Space character
Zero: Numeric 0
They are not the same.
7. Aggregation and Atomicity
Aggregation: ER model concept treating relationships as entities
Atomicity: Transaction is all-or-nothing
8. Levels of Abstraction
1. Physical - how data is stored
2. Logical - what data is stored
3. View - how users see data
9. ER Model
Graphical model showing entities, relationships, and attributes
10. Entity Concepts
Entity: Object (e.g., Student)
Entity Type: Group of similar entities
Entity Set: All entities of a type
11. DDL vs DML vs DCL
DDL: Defines schema (CREATE)
DML: Manipulates data (SELECT)
DCL: Access control (GRANT)
12. HAVING vs WHERE
WHERE: Before aggregation
HAVING: After aggregation
13. Join
Combines rows from tables based on related columns (INNER, LEFT, RIGHT, FULL)
14. View in SQL
Virtual table from a query
CREATE VIEW view_name AS SELECT...
15. Uses of Views
- Data security
- Simplify queries
- Logical independence
16. Trigger
Auto-executed procedure on table events (INSERT, UPDATE)
17. Stored Procedure
Stored SQL block executed on demand
18. Trigger vs Stored Procedure
Trigger: Auto-run on events
Procedure: Called manually
19. Transaction & ACID
Transaction: Unit of work
ACID: Atomicity, Consistency, Isolation, Durability
20. Indexes
Speed up data retrieval, cost extra space
21. WHERE and Aggregates
WHERE filters before aggregates; use HAVING after aggregation
22. Primary vs Unique Key
Primary: No nulls, one per table
Unique: One null, multiple allowed
23. CHAR vs VARCHAR
CHAR: Fixed, padded
VARCHAR: Variable, space-saving
24. GRANT in SQL
Gives privileges (e.g., SELECT, INSERT) to users
25. SQL Command Examples
DDL: CREATE, DROP
DML: SELECT, INSERT
DCL: GRANT, REVOKE
TCL: COMMIT, ROLLBACK