
There can be more than one candidate keys for a table. A candiate key can never be NULL or empty. In our example, student_id and phone both are candidate keys for table Student. There can be more than one candidate key. It is an attribute or a set of attributes that can act as a Primary Key for a table to uniquely identify each record in that table. Candidate KeyĬandidate keys are defined as the minimal set of fields which can uniquely identify each record in a table. Similarly, phone number for every student will be unique, hence again, phone can also be a key. Next comes, (student_id, name), now name of two students can be same, but their student_id can't be same hence this combination can also be a key. In the table defined above super key would include student_id, (student_id, name), phone etc.Ĭonfused? The first one is pretty simple as student_id is unique for every row of data, hence it can be used to identity each row uniquely. Super Key is a superset of Candidate key. Super Key is defined as a set of attributes within a table that can uniquely identify each record within a table. Let's take a simple Student table, with fields student_id, name, phone and age. Let's try to understand about all the keys using a simple example. To avoid all this, Keys are defined to easily identify any row of data in a table. How many trials before you get the right data? Now to fetch any particular record from such dataset, you will have to apply some conditions, but what if there is duplicate data present and every time you try to fetch some data by applying certain condition, you get the wrong data. Tables generally extends to thousands of records stored in them, unsorted and unorganised. In real world applications, number of tables required for storing the data is huge, and the different tables are related to each other as well.Īlso, tables store a lot of data in them. The video below covers all about the different keys in an RDBMS. They are used to establish and identify relationships between tables and also to uniquely identify any record or row of data inside a table.Ī Key can be a single attribute or a group of attributes, where the combination may act as a key. Keys are very important part of Relational database model. ER Model: Generalization and Specialization. Documents can be stored in formats like JSON, BSON, and XML.īelow is a JSON document that stores information about a user named Tom. The values can be a variety of types and structures, including strings, numbers, dates, arrays, or objects. A document typically stores information about one object and any of its related metadata.ĭocuments store data in field-value pairs.
What are the use cases for document databases?Ī document is a record in a document database.
What are the strengths and weaknesses of document databases?.Why not just use JSON in a relational database?.What are the relationships between document databases and other databases?.How much easier are documents to work with than tables?.What makes document databases different from relational databases?.What are the key features of document databases?.In this article, we'll explore answers to the following questions: Document databases are the most popular alternative to tabular, relational databases. Instead of storing data in fixed rows and columns, document databases use flexible documents. A flexible schema that allows for the data model to evolve as application needs change.īecause of these advantages, document databases are general-purpose databases that can be used in a variety of use cases and industries.ĭocument databases are considered to be non-relational (or NoSQL) databases.An intuitive data model that is fast and easy for developers to work with.Document databases offer a variety of advantages, including: