Database Concepts
1.Database Design Concepts
• Database Models: Relational, Hierarchical, Network, Object-oriented
• Tables: Structure of data storage, rows (records), and columns (fields)
• Primary Key: Uniquely identifies each record in a table
• Foreign Key: Ensures referential integrity by linking to a primary key in another
table
• Normalization: Process of organizing data to avoid redundancy (1NF, 2NF, 3NF)
• Denormalization: Combining tables for performance reasons (usually for read-heavy
applications)
• Indexes: Speed up data retrieval operations
2. SQL Command Categories
• DDL (Data Definition Language):
o CREATE, ALTER, DROP, TRUNCATE, RENAME
• DML (Data Manipulation Language):
o INSERT, UPDATE, DELETE, MERGE
• DRL (Data Retrieval Language):
o SELECT, JOIN, GROUP BY, ORDER BY, HAVING
• DCL (Data Control Language):
o GRANT, REVOKE
• TCL (Transaction Control Language):
o COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION
3. SQL Clauses & Operations
• WHERE: Filter rows based on a condition
• AND, OR, NOT: Combine or negate conditions
• IN, BETWEEN, LIKE, IS NULL: Specialized operators for filtering data
• JOIN: Combine rows from two or more tables based on related columns
o INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN
• GROUP BY: Group rows sharing a property and perform aggregate functions
• HAVING: Filter the results after grouping (works with aggregate functions)
• ORDER BY: Sort results by one or more columns (ascending/descending)
• DISTINCT: Remove duplicate rows from the result set
4. Aggregate Functions
• COUNT(): Returns the number of rows in a group
• SUM(): Returns the sum of a numeric column
• AVG(): Returns the average value of a numeric column
• MIN(): Returns the minimum value in a group
• MAX(): Returns the maximum value in a group
5. Subqueries