Database Flashcards
What is normalization in databases?
Normalization is the process of organizing data to reduce redundancy and improve data integrity.
Normalization typically involves dividing a database into tables and defining relationships between them.
What is a primary key?
A primary key is a unique identifier for a record in a database table.
Primary keys ensure that each record can be uniquely retrieved.
What is indexing, and why is it used?
Indexing improves database query performance by creating a data structure (e.g., B-tree) for faster data retrieval.
Indexes can significantly speed up the retrieval of rows from a table.
What is a JOIN in SQL?
A JOIN combines rows from two or more tables based on a related column.
Joins are fundamental for querying related data across multiple tables.
What is the difference between INNER JOIN and LEFT JOIN?
INNER JOIN returns only matching rows; LEFT JOIN returns all rows from the left table and matching rows from the right table.
LEFT JOIN includes non-matching rows from the left table, filling in NULLs for missing matches.
What is MongoDB, and how is it different from SQL databases?
MongoDB is a NoSQL database that stores data in JSON-like documents. It is schema-less and scales horizontally.
Unlike traditional SQL databases, MongoDB allows for flexible data structures.