Made with ScholarlyMake flashcards like these from your own notes
Question:Integrity Constraints
Answer:Rules that restrict data input to ensure the quality and accuracy of the data within a database.
Question:Primary Key Constraints
Answer:A primary key must not contain null values and is used to uniquely identify each record in a table.
Question:Why Primary Key Must Not Contain Null Values
Answer:If the primary key is null, it means the tuple cannot be identified, which violates the purpose of the primary key as a unique identifier for the record.
Question:Foreign Key Constraints
Answer:A foreign key in one table uniquely identifies a tuple in another table, establishing a relationship between the two tables.
Question:1:N Relationship
Answer:A relationship where one instance of a table is related to many instances of another table.
Question:1:N Relationship Example
Answer:In the context of a film database, each director can be related to multiple films, creating a 1:N relationship between the Director and Film tables.
Question:One-to-Many Relationship
Answer:A relationship where one entity (the 'one' side) can be associated with multiple instances of another entity (the 'many' side).
Question:Referential Constraints
Answer:Rules that govern the actions taken in response to an attempt to put the database in an illegal state, such as DELETE actions on foreign key references.
Question:Integrity Constraint Violations
Answer:How to deal with violations of integrity constraints, such as foreign key rules, which may prevent or cascade actions like DELETE.
Question:Relational Model Relationships
Answer:The rule of thumb is to represent a 1:N relationship by adding a reference to the 'one' side into the table representing the 'many' side.
Question:Many-to-Many Relationship Resolution
Answer:The resolution of a many-to-many relationship will be discussed in the near future as part of database design principles.
Question:Database Example
Answer:A database example with tables like NURSE, WARD, and their attributes/relationships, used to illustrate relational concepts.
Question:Candidate Keys
Answer:An attribute or set of attributes that uniquely identifies a tuple or record within a relation or table.
Question:Superkeys
Answer:A set of attributes within a table that uniquely identifies a tuple; it may contain more attributes than necessary to uniquely identify a tuple.
Question:Primary Keys
Answer:A candidate key chosen as the main method of uniquely identifying a tuple within a table.
Question:Foreign Keys
Answer:Attributes in a table that refer to the primary key in another table, establishing a link between the two tables.
Question:Primary Keys
Answer:A primary key is a unique identifier for a record in a database table. It must contain unique values and cannot contain NULL values.
Question:Foreign Keys
Answer:A foreign key is a field in a relational table that matches the primary key column of another table. It establishes a link between the data in two tables.
Question:Candidate Keys
Answer:Candidate keys are the minimal set of attributes that can uniquely identify a tuple in a relation. Each candidate key is a potential candidate for being a primary key.
Question:Superkeys
Answer:A superkey is a set of one or more attributes that, taken collectively, can be used to uniquely identify a record in a table.
Question:Cardinality
Answer:Cardinality refers to the number of tuples (rows) in a relation (table). It indicates the uniqueness of the values in a column or set of columns.
Question:Tuples
Answer:In database management, a tuple is a row in a relational database table. It consists of a set of attributes (columns) that uniquely identify a record.
Question:Relational Algebra
Answer:Relational algebra is a procedural query language used to query the database to generate new relations. It includes various operations such as selection, projection, join, union, and intersection.
Question:Data Definition Language (DDL)
Answer:DDL is a language used to define and modify the structure of the database. It includes commands for creating, altering, and dropping database objects like tables, indexes, and views.
Question:Data Manipulation Language (DML)
Answer:DML is a language used to manipulate the data stored in the database. It includes commands for inserting, updating, deleting, and retrieving data from the database.
Question:SQL (Structured Query Language)
Answer:SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS). It includes commands for querying, inserting, updating, and deleting data.
Question:Select-From-Where Statements
Answer:A SQL query that selects desired attributes from one or more tables based on a specified condition using the WHERE clause. It is used to retrieve specific data from the database.
Question:Database Management System (DBMS)
Answer:A DBMS is software that provides an interface for managing databases and includes tools for defining, creating, querying, updating, and administrating databases. Examples include MySQL, PostgreSQL, and Oracle Database.
Question:Query Optimization
Answer:Query optimization is the process of choosing the most efficient means of executing a SQL query. It involves selecting the best execution plan to improve query performance.
Question:Relation
Answer:In the context of relational databases, a relation refers to a table that holds data in rows and columns. Each row represents a record, and each column represents an attribute of the data.
Question:Data Retrieval
Answer:The process of fetching specific data from a database using SELECT queries in SQL or equivalent operations in other database management systems.
Question:Database Tables
Answer:Database tables are the fundamental storage structures in a database. They consist of rows and columns where each row represents a record, and each column represents an attribute of the data.
Question:Relational Database
Answer:A type of database that stores and provides access to data points that are related to one another. It does this through the use of tables and keys, and it allows for the querying and manipulation of data using SQL.
Question:Attribute
Answer:An attribute is a column in a database table that represents a characteristic or property of the data. It describes the data stored in the database and is given a specific data type.
Question:Procedural Language
Answer:A programming language that follows a step-by-step approach to solve a problem. In the context of databases, it contrasts with declarative languages like SQL, which focuses on specifying the desired result without specifying the sequence of steps to achieve it.
Question:Data Definition
Answer:The process of defining the structure of the database, including tables, indexes, views, and other database objects. It involves specifying the data types, constraints, and relationships among data elements.
Question:What is the result of the query?
Answer:The answer is a relation with a single attribute title and tuples with the title of each movie directed by director d20.
Question:What does SELECT * stand for in the SELECT clause?
Answer:When there is one relation in the FROM clause, SELECT * stands for all attributes of this relation.
Question:Give an example using the film table.
Answer:Example: SELECT * FROM film WHERE dir_id = d20.
Question:What is a multirelation query?
Answer:It is a query that involves multiple relations. Example: SELECT * FROM filmdirector WHERE film_dir_id = director_dir_id AND director_name = 'Steven Spielberg'.
Question:What does writing more than one relation in the FROM clause form?
Answer:It forms the cross product.
Question:Provide an example of finding items sold by Currys to people with a computer science specialty.
Answer:Example: SELECT * FROM sales WHERE seller_name = 'Currys' AND buyer_specialty = 'Computer Science'.