Database Theory Test 2

Database Theory Test 2

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

What is a common hashing algorithm? Explain.

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (150)

Section 1

(50 cards)

What is a common hashing algorithm? Explain.

Front

It's usually a division remainder to determine a record position by dividing each primary key by a suitable prime number and then using the remainder of the division as the relative storage location. Eg. If there are 1000 employees, then closest prime number is 997. Now if an employee has a record of 12396, then we divide this by 997 to get 443 which is stored on file.

Back

What is an attribute in a relation of a database that serves as the primary key of another relation in the same database is called?

Front

Foreign Key

Back

1.In the following reduced form or shorthand notation EMPLOYEE(Emp_ID, Name, Dept_Name, Salary). What is the primary key for the table?

Front

Emp_ID

Back

Which type of entity cannot exist in the database unless another type of entity also exists in the database, but does not require that the identifier of that other entity be included as part of its own identifier?

Front

Weak Entity

Back

What is a well-structured relation?

Front

Any relation that contains minimal redundancy and allows users to insert, modify, and delete the rows in a table without anomalies, errors or inconsistencies

Back

What SQL pattern is used to produce a list of employees and their managers? What do E.lastName and M.lastName mean in the query?

Front

SELECT Employees, Managers FROM _____; E.lastname means the last name for all the employees in the employees table. M.lastname is the same as for employees.

Back

Oracle doesn't have a boolean data type. How do Oracle developers typically indicate a 'Y' or 'N', 'T' or 'F' value?

Front

Oracle developers typically use a CHAR(1) data type, and assign it values of 'T' or 'F').

Back

What does the following SQL statement do? Select * From Customer Where Cust_Type = "Best"?

Front

This brings out all of the records from the 'Customer' table where the 'cust_type' f field is Best. 1)It is selecting all attributes 2) From the customers table 3) And they have to be of the customer type best.

Back

What is the "key to successful denormalization"?

Front

Is to make sure that end users of the system never have to manually duplicate or maintain the redundant data.

Back

Which type of entity has its relationship to another entity determined by an attribute in that other entity called a discriminator?

Front

Subtype Entity

Back

How would you model the repeated attribute phone number in a Contacts database?

Front

Phone 0...*: Phone Number (phoneType)(number)

Back

In the relational model, how are relationships between relations created?

Front

Structures, Operations, Integrity Rules. A relation is a set of tuples. A tuple is an unordered set of attribute values.

Back

What type of integrity constraint maintains consistency among the rows of two relations?

Front

Referential Integrity Constraint

Back

What is a relation?

Front

A named two-dimensional table of data of rows and columns. A tuple has a relation schema, but an entire database has a relational schema.

Back

What does a primary key uniquely identify?

Front

The relation

Back

1.Relation: Employees(EmployeeID,EmployeeName,ManagerID) data 61 Sue Smith (null) 62 David Jones 61 63 Troy Parker 61 64 Claire Smith-Jones 63 65 Grover Rivers 63 What employees are managers?

Front

Ex: Select e.LastName AS Employee, mLastName AS Manager FROM employees e INNER JOIN employees m ON (e.Manager_ID = m.Manage_ID)

Back

What type of key is UPC (Universal Product Code) in the OrderLines and Products tables?

Front

An external key we will use as the primary key for our products table

Back

If an identifier is not assigned to the relation formed from the associative entity, what is the default primary key?

Front

The default primary key is the two primary attributes from the other two relations.

Back

11.How does horizontal partitioning differ from vertical partitioning?

Front

Horizontal Partitioning- distributing the rows of a table into several separate files - Useful for situations where different users need access to different rows Vertical Partitioning - dist the columns of a table into several separate files - Useful for situations where diff users need access to diff columns; (primary key must be repeated in each file)

Back

What is a partial functional dependency?

Front

A functional dependency in which one or more nonkey attributes are functionally dependent on part, but not all, of the primary key.

Back

What is a synonym for tuple in a relational database?

Front

Row

Back

Anamoly

Front

An error or inconsistency that may result when a user attempts to update a table that contains redundant data. The three types of anomalies are insertion, deletion, and modification anomalies.

Back

What does the notation X→Y indicate?

Front

Y is functionally dependent on X

Back

What is the relationship between determinants and candidate keys? Is there one?

Front

A determinant is any attribute that you can use to determine the values assigned to other attribute(s) in the same row. And a candidate key is an attribute, or combination of attributes, that uniquely identifies a row in a relation. Hence, we can say that a candidate key is always a determinant but a determinant is not always the candidate key.

Back

What is the most common form of RAID in use today? What is RAID 5?

Front

RAID 5 is most common. RAID 5 offers the advantages of data storage redundancy along with a high level of performance. It works differently from RAID 0 or 1 by using striping and parity. (striping - dist small segments of data across a number of hard drives) (parity - technique that allows data to be reconstructed from the remaining hard drives in the system if one drive fails)

Back

What is an example of a sub key? What does this mean in a relation?

Front

When we have an attribute or set of attributes that are a super key for some of the other attributes in the relation, but not a super key for the entire relation. An example would be zip code

Back

What is the purpose of the dateTimeOut attribute in the library loan pattern? and what is this type of attribute called? Is it part of the Loans Primary Key?

Front

We have to know the dateTimeOut in order to pair a customer with the same book more than once. We can call this a discriminator attribute, since it allows us to discriminate between the multiple pairings of customer and book.

Back

What is a determinant?

Front

The attribute on the left-hand side of the arrow in a functional dependency.

Back

What is the term for a group of one or more attributes that uniquely identifies a tuple?

Front

Primary Key

Back

What is the purpose of physical database design?

Front

Translate the logical description of data into the technical specifications for storing and retrieving data

Back

What is it called when the value for a non-key attribute of a relation is dependent on the value of some part of the relation's primary key, but not all of it?

Front

Partial Functional Dependency

Back

What are major advantages of partitioning?

Front

1.Efficiency: Records used together are grouped together 2.Local optimization: Each partition can be optimized for performance 3.Security, recovery 4.Load balancing: Partitions stored on different disks, reduces contention

Back

What are the benefits of a standardized relational language?

Front

1.Standards are the same across the system which means there is less adaptability needed in terms of skills for users 2.It also improves productivity because there is less time required for learning the skill of a new language every time when you have a new system. 3.Reduce dependence in a single vendor

Back

Check the order entry example, how is the derived attribute subtotal indicated in the association class OrderLine in a class diagram?

Front

With a /subtotal meaning that it is a derived attribute

Back

What researcher defined the relational data model?

Front

Edgar F. Codd

Back

What do we call a primary key whose value is unique across all relations?

Front

Enterprise Key

Back

What is a functional dependency between two or more nonkey attributes called?

Front

Partial Functional Dependency

Back

What is an example of an update anomaly?

Front

Information appears in multiple rows so may get logical inconsistencies. Ex: For Employee skills table might contain EmployeeID, Employee Address, and Skill so a change in address for a certain employee may have to be applied to multiple records.

Back

In an SQL statement, which parts states the conditions for row selection?

Front

Where

Back

What two conditions must a candidate key satisfy?

Front

Attribute has to be unique and it has to identify a row in a relation.

Back

A relation is in which normal form if it is in BCNF and has no multivalued dependencies?

Front

Fourth Normal Form

Back

What is an enumerated domain? How would you store the domain values?

Front

Attribute domains that may be specified by a well-defined, reasonably-sized set of constant values are called enumerated domains. PKs and FKs link them to other tables as always.

Back

What is the main motivation for creating an enterprise key for a database?

Front

Make it easier to search

Back

When is a relation in first normal form? What criteria must be met?

Front

A relation that has a primary key and in which there are no repeating groups.

Back

What anomalies does normalization to third normal form help avoid?

Front

Update Anomaly, Insertion Anomaly, Deletion Anomaly

Back

What is a functional dependency?

Front

A constraint between two attributes or two sets of attributes

Back

What is the purpose of SQL standard?

Front

The purpose of SQL is to provide an interface to a relational database such as Oracle Database, and all SQL statements are instructions to the database.

Back

How does third normal form differ from second normal form? Explain.

Front

Second Normal Form is in first normal form and gets rid of partial functional dependencies. Whereas third normal form has no transitive functional dependencies.

Back

What is the difference between the functions Count( ), Count(*) and COUNT DISTINCT?

Front

Count( ) and Count (*) are the same as it both counts the number of records in a table. Eg. Select Count(*)/( ) AS NumberofCustomers from Customers adds up all the customers from customer table. Count Distinct totals up unique customers in a table i.e. it doesn't one customer twice from a record

Back

What does the acronym RAID mean?

Front

RAID is Redundant array of independent skills. This is a set of disk drives that appear to the user to be a single disk drive.

Back

Section 2

(50 cards)

What is the Data Definition Language (DDL) used for?

Front

SQL commands to define a database (schema), including creating, altering, and dropping tables and establishing constraints.

Back

What are positive attributes/advantages of indexing?

Front

Provide faster direct data access

Back

9. A row or tuple has a ____Relation___ schema, but an entire database has a __Relational_____ schema.

Front

9. A row or tuple has a ____Relation___ schema, but an entire database has a __Relational_____ schema.

Back

What does the SQL CASE statement do?

Front

Allows you to return varying results based upon the evaluation of expressions. You can use a CASE statement anywhere within a SQL statement that you would normally include an expression. SQL CASE is a very unique conditional statement providing if/then/else logic for any ordinary SQL command, such as SELECT or UPDATE.

Back

How does a Full Outer join differ from a Union join?

Front

Union includes all columns from each table that is joined, and an instance for each row of each table, while a Full Outer join is a join in which rows that do not have matching values in common columns are nonetheless included in the result table.

Back

T/F A candidate key is always a determinant, but a determinant may or may not be a candidate key.

Front

T

Back

What would we call a functional dependency between two (or more) non-key attributes?

Front

Partial Functional Dependency

Back

What is the attribute on the left-hand side of the arrow in a functional dependency called?

Front

Determinant

Back

What operations are classified as Data Manipulation Language (DML)?

Front

Create, Read, Update, Delete, Select

Back

What qualifier is used in the SQL Select command to eliminate duplicate rows in a query?

Front

Distinct

Back

When is an outer join used instead of a natural join?

Front

When you want rows that do not have matching values in common columns are nonetheless included in the result table

Back

What happens when you issue the DELETE FROM tablename command without specifying a WHERE condition?

Front

If WHERE clause is not present, all records will be deleted

Back

What are the requirements for a table to qualify as a relation?

Front

Requirements for a table to qualify as a relation: 1. Table must have a unique name. 2. Every attribute value must be atomic (not multivalued, not composite) 3. Every row must be unique 4. Attributes (columns) in tables must have unique names 5. Order of columns is irrelevant 6. Order of rows is irrelevant

Back

What data type is most appropriate for a character string that is a fixed-width n-character string, padded with spaces as needed?

Front

VARCHAR

Back

Is the SQL SELECT the same as the selection operator in relational algebra?

Front

Yes

Back

T/F A relation is in first normal form when there are no repeating groups in the relation and there is only one determinant of the relation.

Front

F

Back

What type of join can be further classified as an equi-join, natural join, or cross-join?

Front

Inner join

Back

An SQL query that implements an outer join will return rows that do not have matching values in common columns.

Front

T

Back

In Oracle DBMS what is the language that has all of the conditional (IF ...THEN) looping (WHILE), assignment, variable declaration and other language constructs called?

Front

PL/SQL

Back

What is the purpose for building a logical data model?

Front

To help get more detail and communicate with people like DBA's. Using business terms for relations and attributes provides us with common normalized set of relations.

Back

What is the SQL to list the finish and standard price for all desks with a Standard_Price greater than $300 in the PRODUCT table? (Note: desk is a product description).

Front

SELECT Product_Finish AS 'Finished Product', Standard_Price AS 'Standard Price' FROM Product WHERE Standard_Price>300 AND Product_Description = 'Desk';

Back

What is the goal of database normalization?

Front

To have a well-structured relation containing minimal data redundancy and allows users to insert, delete, and update rows without causing data inconsistencies or anomalies.

Back

. Which of the following CASE expressions says if a Score is 60 or above it's a "Pass" or below 60 it's a "Fail"? A. CASE IF n >= 60 THEN 'Pass' OR n < 60 THEN 'Fail' B. CASE IF n >= 60 THEN 'Pass' ELSE 'Fail' C. CASE IF n >= 60 THEN 'Fail' OR n < 60 THEN 'Pass' D. CASE WHEN n >= 60 THEN 'Pass' ELSE 'Fail'

Front

D

Back

What command is used to delete a table from a database?

Front

DELETE

Back

What are the basic statements of DDL?

Front

Create, Alter, Drop

Back

What is horizontal partitioning?

Front

Distribution of the rows of a logical relation into several separate tables.

Back

A relation that has no multivalued attributes, but does have partial functional or transitive dependencies is in what normal form?

Front

Second Normal Form

Back

What are the various types of indexes?

Front

Bitmap index --> stores most of its data as bit arrays Dense index --> An index record appears for every search key value in file - Hash index Sparse index --> Index records are created only for some of the records. Reverse key index --> reverses the key value before entering it in the index of its data as bit arrays, e.g., the key value 24538 becomes 83542 in the index. Reversing the key value is particularly useful for indexing data such as sequence numbers

Back

What are the three anomaly types that are avoided by normalizing the database?

Front

1) Insert Anomaly 2) Update Anomaly 3) Delete Anomaly

Back

What is a primary key whose value is unique across all relations called?

Front

Enterprise Key

Back

What is the SQL equivalent of the CRUD acronym?

Front

Create, Read, Update, Delete

Back

What are the "left" and "right" tables in an outer join?

Front

Left table is the first table and right is the second table.

Back

What is the SQL to list all customers who live in Eastern US states of "FL", "NY", "NY"? List the customers alphabetically by state and alphabetically by customer within each state.

Front

SELECT Customer_Name AS 'Customer Name', State; FROM Customer WHERE State = 'FL' OR State= 'NY' ORDER BY State, Customer_Name;

Back

What are the two parts of the internal schema?

Front

Physical and Logical

Back

The selection, or restriction, operation retrieves tuples from a relation, limiting the results to only those that meet a specific criteria. The SQL equivalent of selection is the ______ query statement with a ________ clause.

Front

Select and Where clause

Back

In 1986, what organizations adopted SQL as a standard?

Front

American National Standards Institute

Back

Which SQL statement will select all rows from a table called "Employee" and orders the results by "Employee_Name" A. SELECT * FROM Employee ORDER Employee_Name; B. SELECT * FROM Employee ORDER ON Employee_Name; C. SELECT * FROM Employee ORDER BY Employee_Name; D. SELECT * FROM Employee ORDERED Employee_Name;

Front

C

Back

How many orders did each customer place in August 2014? What type of join would you use?

Front

SELECT Customer.Customer_Name, Order.Order_ID FROM Customer FULL OUTER JOIN Orders ON Customer.Customer_ID=Order.Customer_ID ORDER BY Customer.Customer_Name;

Back

How would you list the Customer_ID and Customer_Name for all Customers in alphabetical order?

Front

SELECT Customer_ID, Customer_Name FROM Customers ORDER BY Customer_Name;

Back

What is a Self Join in SQL?

Front

A relation that is joined to itself Ex: Select e.LastName AS Employee, mLastName AS Manage FROM employees e INNER JOIN employees m ON (e.Manager_ID = m.Manage_ID)

Back

What is Relational algebra?

Front

A formal system for manipulating relations

Back

What is the purpose of the SQL HAVING clause?

Front

It is used for aggregate functions b/c WHERE does not work with aggregate functions

Back

What records does a full outer join return?

Front

The FULL OUTER JOIN keyword returns all the rows from the left table (Customers), and all the rows from the right table (Orders). If there are rows in "Customers" that do not have matches in "Orders", or if there are rows in "Orders" that do not have matches in "Customers", those rows will be listed as well.

Back

What are the 3 primary Relational Algebra operators?

Front

Selection - Filters the rows Projection - Shows columns you want Join - Join tables together

Back

One of the original purposes of the SQL standard was to provide a vehicle for portability of database definition and application modules between conforming DBMSs.

Front

T

Back

What theoretical RAID level is not used in practice?

Front

RAID 2

Back

What is the difference between second normal form and third normalization form?

Front

Third normal form has no transitive dependencies no non key fields are trasitively dependent upon the key fields.

Back

What is an alternate name given to a column or table in any SQL statement called?

Front

Relation or Attribute

Back

An equi-join is a join in which one of the duplicate columns is eliminated in the result table.

Front

F

Back

What is a foreign key?

Front

An attribute in a relation that serves as the primary key of another relation in the same database. An identifier that enables a dependent relation (on the many side of a relationship) to refer to its parent relation (on the one side of the relationship).

Back

Section 3

(50 cards)

normal form

Front

A state of a relation. Each normal form has rules regarding relationships between attributes (or functional dependencies) that must be satisfied.

Back

There can be multivalued attributes in a relation in 3rd Normal Form.

Front

F

Back

composite key-

Front

A primary key that consists of more than one attribute.

Back

The columns of a relation can be interchanged without changing the meaning or use of the relation.

Front

T

Back

materialized view

Front

Copies or replicas of data based on SQL queries created in the same manner as dynamic views are. However, a materialized view exists as a table and thus care must be taken to keep it synchronized with its associated base tables

Back

normalization

Front

Normalization is the process of organizing the fields and tables of a relational database to minimize redundancy.

Back

If a column or set of columns is designated as UNIQUE, that column or set of columns is a primary key or a foreign key.

Front

F(only primary key)

Back

dynamic view

Front

A virtual table that is created dynamically upon request by user. A dynamic view is not a temporary table. Rather, its definition is stored in the system catalog and the contents of the views are materialized as a result of an SQL query that uses the view. Its differs from a materialized view, which may be stored on a disk and refreshed at intervals or when used, depending on the RDBMS.

Back

enterprise key

Front

Primary keys that are unique in the whole database, not just within a single relation.

Back

The last SQL statement to execute is ORDER BY.

Front

T

Back

equi-join

Front

Specific type of comparator-based join that uses only equality comparisons in the join-predicate. entity integrity rule

Back

A default value is the value that a field will always assume, regardless of what the user enters for an instance of that field.

Front

T

Back

primary key

Front

An attribute or a combination of attributes that uniquely identifies each row in a relation.

Back

well-structured relation

Front

Any relation that contains minimal redundancy and allows users to insert, modify, and delete the rows in a table without anomalies, errors or inconsistencies.

Back

hashing algorithm

Front

Usually division-remainder to determine record position, e.g., dividing each primary key value by a suitable prime number and then using the remainder of the division as the relative storage location. Records with same storage location are grouped in lists.

Back

recursive foreign key

Front

A foreign key in a relation that references the primary key values of the same relation.

Back

T/F A natural join is the same as an equi-join, except that it is performed over matching columns that have been defined with the same name and one of the duplicate columns is eliminated.

Front

T

Back

Data Manipulation Language (DML)

Front

Commands used to maintain and query a database, including updating, inserting, modifying, and querying data.

Back

The order of columns of a relation can NOT be interchanged without changing the meaning or use of the relation.

Front

F

Back

A hashing algorithm is an algorithm that converts a primary key value into a relative record number.

Front

T

Back

physical file-

Front

A named portion of secondary memory allocated to store physical records.

Back

hashed file organization-

Front

address for each row is determined using an algorithm.

Back

partition

Front

a division of a logical database or its constituting elements into distinct independent parts. Database partitioning is normally done for manageability, performance or availability reasons.

Back

outer join

Front

The FULL OUTER JOIN keyword returns all rows from the left table (table1) and from the right table (table2).

Back

SQL is a record-oriented language.

Front

F it is a set oriented language

Back

The SQL HAVING clause acts like a WHERE clause, but it identifies groups that meet a criterion, rather than rows.

Front

T

Back

RAID

Front

RAID (redundant array of independent disks; originally redundant array of inexpensive disks) is a way of storing the same data in different places (thus, redundantly) on multiple hard disks.

Back

A correlated query requires that a value be known from the inner query to process the outer query.

Front

F

Back

referential integrity constraint

Front

A rule that states that either each foreign key value must match a primary key value in another relation or the foreign key value must be null.

Back

denormalization

Front

Process of transforming normalized relations into non-normalized physical record specifications.

Back

An enterprise key is a foreign key whose value is unique across all relations.

Front

F

Back

Data Definition Language (DDL)-

Front

Commands used to define a database, including creating, altering, and dropping tables and establishing constraints.

Back

physical database design

Front

Is the process of translating a logical description of data into technical specifications for storing and retrieving data.

Back

A cascading delete removes all records in other tables associated with the record to be deleted.

Front

T

Back

candidate key

Front

An attribute, or combination of attributes, that uniquely identifies a row in a relation.

Back

Horizontal partitioning

Front

Distribution of the rows of a logical relation into several separate tables.

Back

Vertical partitioning

Front

Distribution of the columns of a logical relation into several separate physical tables.

Back

Indexes are most useful for columns that frequently appear in WHERE clauses of SQL commands, either to qualify the rows to select or for linking.

Front

F

Back

The original purpose of the SQL standard was to provide a means for portability of database definition and application modules between conforming DBMSs.

Front

T

Back

determinant

Front

The attribute on the left-hand side of the arrow in a functional dependency (A -> B). A determinant in a database table is any attribute that you can use to determine the values assigned to other attribute(s) in the same row.

Back

Relation

Front

named two-dimensional table of data.

Back

index

Front

Is a sorted list of pointers stored along with the actual data. It's additional physical file. A table or other data structure used to determine the location of records in a file that satisfy some condition.

Back

The WHERE clause is always processed before the GROUP BY clause when both occur in a SELECT statement.

Front

T

Back

A partial functional dependency is a functional dependency in which one or more non-key attributes are functionally dependent on part (but not all) of the primary key.

Front

T

Back

In a 1:M relationship, the primary key attribute of the entity on the one-side of the relationship becomes a foreign key in the relation on the many-side.

Front

T

Back

functional dependency-

Front

A constraint between two attributes (or two sets of attributes) in which the value of one attribute is determined by the value of another attribute. A functional dependency occurs when one attribute in a relation uniquely determines another attribute. This can be written A -> B which would be the same as stating "B is functionally dependent upon A." For example, in a table listing employee characteristics including Social Security Number (SSN) and name, name is functionally dependent upon SSN (or SSN -> name) because an employee's name can be uniquely determined from their SSN. However, the reverse statement (name -> SSN) is not true because more than one employee can have the same name but different SSNs

Back

transitive dependency

Front

A functional dependency between the primary key and one or more nonkey attributes that are dependent on the primary key via another nonkey attribute.

Back

A database table is defined using the data definition language (DDL).

Front

T

Back

foreign key-

Front

An attribute in a relation that serves as the primary key of another relation in the same database. An identifier that enables a dependent relation (on the many side of a relationship) to refer to its parent relation (on the one side of the relationship).

Back

SQL is a nonprocedural language and no statement execution sequence is implied.

Front

F

Back