Databases Flashcards
Name two types of DBMS
RDBMS
NoSQL
What is an RDBMS, examples, and the use cases
- Relational Database Management Systems (RDBMS)
- Description: Stores data in structured tables with rows and columns, following a predefined schema.
- Examples: MySQL, PostgreSQL, Oracle, Microsoft SQL Server.
- Use Case: Applications requiring complex queries, transaction management, and strong consistency.
What is NoSQL
- NoSQL Database
- Description : Flexible, schema-less databases for handling unstructured or semi-structured data.
- Types:
- Document-based: MongoDB
- Key-value: Redis
- Column-based: Cassandra
- Graph-based: Neo4j
- Use Case: Big data, real-time analytics, highly scalable applications.
What does an RDBMS do basically
the “relational” aspect refers to the relationships between tables. These relationships are established using keys (primary keys and foreign keys), which connect data across different tables in a structured and organized way.
Characteristics of Primary Keys
- Definition: A column (or set of columns) that uniquely identifies each record in a table.
- Key Points:
- Must contain unique values.
- Cannot contain
NULL
values. - Each table can have only one primary key.
- Purpose: Ensures that each row in the table is unique.
- Example: In a
Students
table,StudentID
is the primary key that uniquely identifies each student.
Foreign Key
- A column (or set of columns) in one table that creates a link to the primary key of another table. It establishes the relationship between the two tables.
- Key Points:
- Can contain duplicate values.
- Can contain
NULL
values (unless restricted by aNOT NULL
constraint). - A table can have multiple foreign keys.
- Purpose: Maintains referential integrity between tables by linking rows from one table to another.
- Example: In an
Enrollments
table,StudentID
is a foreign key that referencesStudentID
in theStudents
table.
Types of relationships
-
One-to-One: Each record in one table is linked to only one record in another table.
- Example: A
Person
table might have a one-to-one relationship with aPassport
table (one person, one passport).
- Example: A
-
One-to-Many: A record in one table is related to multiple records in another table.
- Example: A
Teacher
table could have a one-to-many relationship with aClass
table (one teacher teaches multiple classes).
- Example: A
-
Many-to-Many: Multiple records in one table are related to multiple records in another table, typically handled with a junction or associative table.
- Example: A
Students
table and aCourses
table might have a many-to-many relationship, managed by anEnrollments
table (many students enroll in many courses).
- Example: A
Why do we even have keys in RDBMS
- To make a connection between the data
- To locate and collect the unique data that we require
What does SQL stand for
Structured Query Language
What does SQL do vele
Helps access and manipulate your databases
What is ANSISQL
- A standardized version of SQL for managing and manipulating databases.
- Ensures consistency across different database management systems (DBMS).
ANSI SQL promotes a consistent, flexible, and efficient approach to database management, making it essential for developers and data professionals.