Relational Databases Flashcards
(10 cards)
How does a relational database store data and what are the basic components?
Stores data in tables with rows (individual data records/entities) and columns (data attributes/properties). Data is parsed into multiple tables connected using keys
What are primary and foreign keys and how do they create connections between tables?
Primary keys uniquely identify each record in a table. Foreign keys reference primary keys in other tables, creating relationships and connections between different tables
What two key principles govern relational database table design?
- Each table contains only minimal information with every informational theme (business concept) having its own table. 2. All attributes in a table must depend only on the primary key and nothing else
Why must all attributes in a table depend only on the primary key? Give an example of what violates this rule.
Prevents data redundancy and inconsistency. Violation example: A table with CustomerID (primary key), CustomerName, OrderDate, and ProductPrice - ProductPrice depends on the product, not the customer, so it belongs in a separate table
What is a Relational Database Management System (RDBMS) and what role does it play?
Software that allows interaction with databases - like the operating system of the database. It interprets queries and commands and executes database operations
What are the 4 main categories of operations possible on a relational database through an RDBMS?
- Database Design (planning structure, tables, relationships), 2. Construction (creating and populating database), 3. Data manipulation (insert, delete, update, query), 4. Reporting (summarizing data for analysis)
Distinguish between Database Design and Construction operations with examples.
Database Design: Planning structure, designing tables, setting relationships (conceptual work). Construction: Actually creating the database, building tables, populating with initial data (implementation work)
Categorize these operations: SELECT queries, CREATE TABLE, INSERT records, generating sales reports, UPDATE customer info, DELETE old records.
Data Manipulation: SELECT queries, INSERT/UPDATE/DELETE records. Database Design-Construction: CREATE TABLE. Reporting: generating sales reports
What is the relationship between SQL and relational databases?
SQL is the programming language specifically used to communicate with and control relational databases - it’s the standard interface for all relational database operations
You have customer data: names, addresses, orders, and products. How should this be organized in a relational database and why?
Separate tables: Customers (names, addresses), Orders (order details), Products (product info). Each represents a distinct business concept. Tables connected via keys - CustomerID in Orders table, ProductID linking to Products table