Databases Flashcards
What are the three main types of databases used today?
- Flat file (e.g. Microsoft Excel)
Unflexible, Simple, Cannot alter data, Entry duplications - Relational Databases (e.g. SQL)
Structured, allows grouping of data by relations, efficient and reliable, well established - NoSQL (e.g Mongo)
Unstructured, Eliminate the need for strict relations, Flexibility in how to store data, Relatively new.
What is a relational database?
This model organizes data into one or more tables (or “relations”) of columns and rows, with a unique key identifying each row. Rows are also called records or tuples. Columns are also called attributes. Generally, each table/relation represents one “entity type” (such as customer or product). The rows represent instances of that type of entity (such as “Lee” or “chair”) and the columns representing values attributed to that instance (such as address or price).
Virtually all relational database systems use SQL (Structured Query Language) for querying and maintaining the database.
What is the purpose of a key in a relational database?
Virtually all relational database systems use SQL (Structured Query Language) for querying and maintaining the database.
What is a primary key?
In the relational model of databases, a primary key is a specific choice of a minimal set of attributes (columns) that uniquely specify a tuple (row) in a relation (table).[a] Informally, a primary key is “which attributes identify a record”, and in simple cases are simply a single attribute: a unique id.
What is a foreign key?
In the context of relational databases, a foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table or the same table.[1][2][3] In simpler words, the foreign key is defined in a second table, but it refers to the primary key or a unique key in the first table.
What is a relational database relationship?
Relationships are a logical connection between different tables, established on the basis of interaction among these tables.
What is a constraint?
Constraints make it possible to further restrict the domain of an attribute. For instance, a constraint can restrict a given integer attribute to values between 1 and 10. Constraints provide one method of implementing business rules in the database and support subsequent data use within the application layer. SQL implements constraint functionality in the form of check constraints. Constraints restrict the data that can be stored in relations. These are usually defined using expressions that result in a boolean value, indicating whether or not the data satisfies the constraint. Constraints can apply to single attributes, to a tuple (restricting combinations of attributes) or to an entire relation.
What is database normalisation?
Database normalization is the process of restructuring a relational database in accordance with a series of so-called normal forms in order to reduce data redundancy and improve data integrity.
Normalization entails organizing the columns (attributes) and tables (relations) of a database to ensure that their dependencies are properly enforced by database integrity constraints. It is accomplished by applying some formal rules either by a process of synthesis (creating a new database design) or decomposition (improving an existing database design).
What is required for a database to achieve 3rd normal form?
Third normal form (3NF) is a normal form that is used in normalizing a database design to reduce the duplication of data and ensure referential integrity by ensuring that (1) the entity is in second normal form, and (2) all the attributes in a table are determined only by the candidate keys of that relation and not by any non-prime attributes.
What is a NoSQL database?
A NoSQL is a non-relational database increasingly used for big data and real time web applications.
Motivations for this approach include: simplicity of design, simpler “horizontal” scaling to clusters of machines (which is a problem for relational databases), and finer control over availability. The data structures used by NoSQL databases (e.g. key-value, wide column, graph, or document) are different from those used by default in relational databases, making some operations faster in NoSQL. The particular suitability of a given NoSQL database depends on the problem it must solve. Sometimes the data structures used by NoSQL databases are also viewed as “more flexible” than relational database tables.