3.2 Databases (OCR A Level Computer Science) Flashcards

Exam code: H446

1/92

0Still learning

Know0

  • What is a database?

Cards in this collection (92)

  • What is a database?

    A database is an organised collection of data that allows easy storage, retrieval, and management of information.

  • Define primary key.

    A primary key is a unique identifier for each record in a table, usually an ID number.

  • A         in a table refers to the primary key in another table and is used to link tables and create relationships.

    A foreign key in a table refers to the primary key in another table and is used to link tables and create relationships.

  • True or False?

    Multiple users can access the same electronic database at the same time from different locations.

    True.

    Electronic databases allow multiple users from multiple locations to access the same database simultaneously, which is a key benefit over paper-based systems.

  • Define primary key.

    A primary key is a field in a database table that uniquely identifies each record in that table.

  • Define foreign key.

    A foreign key is a field in one table that links to the primary key of another table, establishing a relationship between the two tables.

  • In the orders table,        is the primary key and           is a foreign key.

    In the orders table, order_id is the primary key and customer_id is a foreign key.

  • What is indexing in a database and what is a secondary key?

    Indexing is a technique used in databases to speed up data retrieval. A secondary key is a field that has been indexed to allow quicker searches without scanning every record.

  • Define flat file database.

    A flat file database is a database that stores all data in a single table, which can cause data redundancy and make maintenance difficult.

  • A relational database organises data into multiple tables and uses         to connect related data, reducing        and improving efficiency.

    A relational database organises data into multiple tables and uses keys to connect related data, reducing redundancy and improving efficiency.

  • True or False?

    A flat file database makes it easy to avoid redundant data and maintain consistency.

    False.

    A flat file database often causes data redundancy and is harder to maintain than a relational database.

  • What problem arises if a customer wants to insure more than one car in a flat file database?

    The flat file database would require repeating the customer's data for each car, causing redundant data and possible inconsistencies.

  • Define First Normal Form (1NF).

    A table is in First Normal Form (1NF) if it contains only atomic values, has no repeating groups, has unique column names, and includes a unique identifier (primary key) for each row.

  • A table is in first normal form if it contains         values and has no         .

    A table is in first normal form if it contains atomic values and has no repeating groups.

  • What does it mean for a value in a database table to be atomic?

    A value is atomic if it is a single, indivisible value, not a list or array.

  • Define Second Normal Form (2NF).

    A table is in Second Normal Form (2NF) if it is in 1NF and all non-prime attributes are fully dependent on the whole of every candidate key (has no partial dependencies).

  • True or False?

    A table with a single-column primary key can be in Second Normal Form.

    False.

    Second Normal Form only applies to tables with a compound (composite) primary key, because partial dependencies can only occur in such tables.

  • In second normal form, all non-prime attributes must be         dependent on the         key.

    In second normal form, all non-prime attributes must be fully dependent on the whole primary key.

  • What is a partial dependency in database normalisation?

    A partial dependency occurs when a non-prime attribute is dependent on only part of a compound primary key.

  • Define Third Normal Form (3NF).

    A table is in Third Normal Form (3NF) if it is in 2NF and all non-prime attributes are dependent only on the primary key, not on other non-prime attributes (no transitive dependencies).

  • In third normal form, there must be no         dependencies between non-prime attributes.

    In third normal form, there must be no transitive dependencies between non-prime attributes.

  • What is a transitive dependency in a database table?

    A transitive dependency occurs when a non-prime attribute depends on another non-prime attribute, rather than directly on the primary key.

  • True or False?

    A table must be in first normal form before it can be in second or third normal form.

    True.

    A table must meet all requirements of lower normal forms before achieving a higher normal form.

  • A table in third normal form must also satisfy the conditions of         and         .

    A table in third normal form must also satisfy the conditions of first normal form and second normal form.

  • Why must tables with transitive dependencies be split into separate tables in 3NF?

    Because in Third Normal Form, each non-prime attribute must depend only on the primary key, so splitting removes transitive dependencies and maintains data integrity.

  • Define entity.

    An entity is something worthy of capturing and storing data about, such as students, orders, or products.

  • Define one to many relationship.

    A one to many relationship is a relationship where one record in an entity is associated with multiple records in another entity, but each record in the second entity is associated with only one record in the first.

  • Define entity relationship diagram (ERD).

    An entity relationship diagram (ERD) is a diagram that represents the entities (tables) in a database and the relationships between them.

  • A       in a relational database becomes a       .

    A entity in a relational database becomes a table.

  • The relationship between a customer and an order is         to      .

    The relationship between a customer and an order is one to many.

  • A         to         relationship cannot be directly implemented in a relational database and must be resolved using a         .

    A many to many relationship cannot be directly implemented in a relational database and must be resolved using a link table.

  • What are the three main types of entity relationships in a database?

    The three main types of entity relationships are one to one, one to many, and many to many.

  • True or False?

    In a relational database, all entities are stored in a single table.

    False.

    In a relational database, different entities are stored in separate tables.

  • What is the relationship between an order and a product in an online store database?

    The relationship between an order and a product is many to many, since an order can contain multiple products and a product can be on multiple orders.

  • What does a foreign key indicate in an entity relationship diagram (ERD)?

    A foreign key in an ERD indicates a field in one table that links to the primary key of another, showing a relationship between the entities.

  • True or False?

    Crow's feet notation is used to show relationships in ERDs.

    True.

    Crow's feet notation is commonly used in entity relationship diagrams to show the type of relationship between entities.

  • To resolve a many to many relationship, a new      table is created between the two entities.

    To resolve a many to many relationship, a new link table is created between the two entities.

  • What information can you determine from an entity relationship diagram (ERD)?

    An ERD shows the entities (tables), their relationships, and which tables will have a foreign key.

  • Define Optical Mark Recognition (OMR).

    Optical Mark Recognition (OMR) is a technology that detects marked areas on paper using a special machine, commonly used for exams and surveys to automate data collection.

  • A barcode is a machine-readable representation of data using        lines of varying widths and spacings, commonly used for            .

    A barcode is a machine-readable representation of data using parallel lines of varying widths and spacings, commonly used for tracking items.

  • What is the main purpose of a data capture form?

    The main purpose of a data capture form is to collect user input and organize data in a structured format, commonly in web applications.

  • True or False?

    Sensors convert physical signals from the environment into digital data for automated collection.

    True.

    Sensors convert physical signals into digital data to enable automated data collection and real-time monitoring in various applications.

  • Define Query By Example (QBE).

    Query By Example (QBE) is a user-friendly method for constructing database queries using a visual interface, allowing users to search for data by providing an example of the desired output.

  • What is a key advantage of using Query By Example (QBE) over writing SQL queries?

    A key advantage of QBE is that it provides a more accessible and easy-to-use interface for users, especially non-technical users, compared to writing complex SQL queries.

  • True or False?

    Query By Example (QBE) allows users to join multiple tables and perform aggregation operations.

    True.

    QBE supports joining tables and aggregation operations such as counting or averaging values.

  • In Query By Example (QBE), users enter criteria in the         or fields, and the system translates it into an SQL query.

    In Query By Example (QBE), users enter criteria in the QBE grid or fields, and the system translates it into an SQL query.

  • Define Database Manipulation Language (DML).

    A Database Manipulation Language (DML) is a set of commands, such as SQL, used to add, edit or delete data in a database.

  • A     stores tabular data in plain text using       to separate values.

    A CSV stores tabular data in plain text using commas to separate values.

  • What is the main advantage of using Electronic Data Interchange (EDI) between businesses?

    The main advantage of EDI is that it streamlines transactions by electronically transferring documents and data, reducing paper usage and manual processes.

  • True or False?

    APIs only allow data exchange between applications written in the same programming language.

    False.

    APIs are protocols that allow different software applications, regardless of programming language, to communicate and exchange data.

  • Define SQL.

    SQL stands for Structured Query Language, a programming language used to interact with a DBMS.

  • What does the SELECT statement do in SQL?

    The SELECT statement retrieves data from a database table.

  • The WHERE clause in SQL is used to             which rows are returned from a table.

    The WHERE clause in SQL is used to filter which rows are returned from a table.

  • True or False?

    The LIKE operator in SQL can be used to search for patterns in text fields using wildcards.

    True.

    The LIKE operator allows pattern matching using wildcards such as % in SQL.

  • Define nested SELECT in SQL.

    A nested SELECT is a SELECT statement placed inside another SELECT statement, often used to filter results based on a subquery.

  • What is the purpose of an INNER JOIN in SQL?

    An INNER JOIN combines rows from two or more tables based on a related column, returning only records that have matching values in both tables.

  • True or False?

    A nested SELECT can be used in a WHERE clause to filter records based on aggregate calculations from the same table.

    True.

    A nested SELECT is often used in a WHERE clause to compare values, such as finding all records where a field is greater than the average of that field in the table.

  • To retrieve user names and their corresponding order IDs from two tables, you use an         clause to combine the tables based on a related column.

    To retrieve user names and their corresponding order IDs from two tables, you use an INNER JOIN clause to combine the tables based on a related column.

  • Define INSERT command.

    The INSERT command is used to add new data to a database table.

  • Which SQL command would you use to add a new record to a table?

    You use the INSERT command to add a new record to a table in SQL.

  • To insert a new user named John Doe who is 25 into the users table, the SQL command would be: INSERT INTO users (name, age) VALUES (                   ,         );

    To insert a new user named John Doe who is 25 into the users table, the SQL command would be: INSERT INTO users (name, age) VALUES ('John Doe', 25);

  • True or False?

    The INSERT command in SQL can only add one new row at a time.

    False.

    The INSERT command can add multiple rows at once by specifying multiple sets of values.

  • Define DELETE command.

    The DELETE command is an SQL statement used to remove records from a database table based on specified conditions.

  • What does the following SQL statement do?

    DELETE FROM users WHERE age < 18;

    This SQL statement removes all records from the users table where the age is less than 18.

  • To remove all employees from the Employees table who work in the Marketing department, use the command: DELETE FROM Employees WHERE         =         .

    To remove all employees from the Employees table who work in the Marketing department, use the command: DELETE FROM Employees WHERE Department= 'Marketing'.

  • True or False?

    An SQL DELETE statement can remove all records from a table without specifying a WHERE clause.

    True.

    If no WHERE clause is given, the DELETE statement removes all records from the table.

  • Define DROP TABLE command.

    The DROP TABLE command permanently deletes an entire table and its data from a database.

  • What is the effect of executing DROP TABLE Employees; in a database?

    Executing DROP TABLE Employees; will delete the Employees table and all its data permanently from the database.

  • To remove a table named Users from a database, use the command:                   .

    To remove a table named Users from a database, use the command: DROP TABLE Users;.

  • True or False?

    The DROP command can be used to delete individual rows from a table.

    False.

    The DROP command deletes entire tables, not individual rows. To delete rows, you use the DELETE command instead.

  • Define referential integrity.

    Referential integrity ensures consistency between related tables in a relational database by maintaining valid relationships between primary and foreign keys.

  • True or False?

    A foreign key can reference a primary key value that does not exist in the related table.

    False.

    Referential integrity requires that every foreign key value must match an existing primary key in the related table or be null (if allowed).

  • A database enforces referential integrity by ensuring that each          key value in one table matches a         key value in another table.

    A database enforces referential integrity by ensuring that each foreign key value in one table matches a primary key value in another table.

  • What is the purpose of a foreign key constraint in a relational database?

    A foreign key constraint ensures that a value in a foreign key field either matches a primary key value in the related table or is null (if allowed), helping to enforce referential integrity.

  • When a record with a primary key is deleted and related foreign keys are also deleted, this is called a          delete.

    When a record with a primary key is deleted and related foreign keys are also deleted, this is called a cascaded delete.

  • What does the SET NULL action do in referential integrity rules?

    The SET NULL action sets the foreign key value to null in related records when the referenced primary key is deleted or updated.

  • List one benefit and one drawback of enforcing referential integrity in databases.

    A benefit is that referential integrity prevents orphaned records and ensures data consistency. A drawback is that it may impact performance due to additional checks.

  • To maintain referential integrity, a database system can use        with built-in support and implement         to enforce custom rules.

    To maintain referential integrity, a database system can use DBMS with built-in support and implement triggers to enforce custom rules.

  • Define transaction.

    A transaction is a sequence of database operations treated as a single unit of work. All operations in a transaction must succeed together or fail together to ensure data consistency and integrity.

  • If two or more transactions are waiting for each other to release resources, a         occurs, causing them to wait indefinitely.

    If two or more transactions are waiting for each other to release resources, a deadlock occurs, causing them to wait indefinitely.

  • What is the purpose of locking in transaction processing?

    Locking ensures that no two transactions can access the same data simultaneously, preventing data inconsistencies during simultaneous access.

  • True or False?

    The commit operation saves all changes made in a transaction as permanent.

    True.

    The commit operation makes all changes in the transaction permanent in the database.

  • Define Atomicity in the context of ACID transactions.

    Atomicity means that all operations in a transaction must succeed or fail as a whole. If any operation fails, the transaction is rolled back, preventing partial completion.

  • What does Consistency ensure in a database transaction under the ACID properties?

    Consistency ensures that a database remains in a valid state before and after a transaction, following all rules and constraints, so data integrity is not compromised.

  • In ACID,           means that each transaction is processed independently and intermediate states are not visible to other transactions.

    In ACID, Isolation means that each transaction is processed independently and intermediate states are not visible to other transactions.

  • True or False?

    Under the Durability property of ACID, data from committed transactions may be lost if the system crashes after the transaction completes.

    False.

    Durability ensures that committed transactions persist even if the system fails, so data is not lost after a transaction is complete.

  • Define record locking.

    Record locking is a technique used in database management systems (DBMS) to prevent conflicting access to data by multiple transactions or processes, ensuring data consistency and integrity.

  • A       is a mechanism that prevents access to a database record by other transactions while a specific transaction is using the record.

    A lock is a mechanism that prevents access to a database record by other transactions while a specific transaction is using the record.

  • True or False?

    Shared locks allow multiple transactions to modify a record at the same time.

    False.

    A shared lock allows multiple transactions to read a record simultaneously, but does not allow modifications until the lock is released.

  • What is the main benefit of record locking in a DBMS?

    The main benefit of record locking is that it maintains data consistency and integrity by preventing conflicting access and modifications by multiple transactions.

  • Define redundancy in a database context.

    In a database, redundancy occurs when the same piece of data is stored in more than one table, either by accident or by design.

  • True or False?

    Redundancy in databases can lead to inconsistencies in the data and wasted storage space.

    True.

    Redundancy can cause data to be inconsistent if updates are not made everywhere, and it also wastes storage space by duplicating data.

Sign up to unlock flashcards

or