

In a database, you have entities (which have attributes), and relationships between those entities. Managing them is key to preventing chaos from engulfing your database, which is where the concept of keys comes in. These unique identifiers enable you to pick specific rows in an entity set, as well as define their relationships to rows in other entity sets, allowing your database to handle complex computations.
Let’s explore keys in DBMS (database management systems) in more detail, before digging into everything you need to know about the most important keys – primary keys.
Understanding Keys in DBMS
Keys in DBMS are attributes that you use to identify specific rows inside a table, in addition to finding the relation between two tables. For example, let’s say you have a table for students, with that table recording each student’s “ID Number,” “Name,” “Address,” and “Teacher” as attributes. If you want to identify a specific student in the table, you’ll need to use one of these attributes as a key that allows you to pull the student’s record from your database. In this case “ID Number” is likely the best choice because it’s a unique attribute that only applies to a single student.
Types of Keys in DBMS
Beyond the basics of serving as unique identifiers for rows in a database, keys in DBMS can take several forms:
- Primary Keys – An attribute that is present in the table for all of the records it contains, with each instance of that attribute being unique to the record. The previously-mentioned “ID Number” for students is a great example, as no student can have the same number as another student.
- Foreign Key – Foreign keys allow you to define and establish relationships between a pair of tables. If Table A needs to refer to the primary key in Table B, you’ll use a foreign key in Table A so you have values in that table to match those in Table B.
- Unique Key – These are very similar to primary keys in that both contain unique identifiers for the records in a table. The only difference is that a unique key can contain a null value, whereas a primary key can’t.
- Candidate Key – Though you may have picked a unique attribute to serve as your primary key, there may be other candidates within a table. Coming back to the student example, you may record the phone numbers and email addresses of your students, which can be as unique as the student ID assigned to the individual. These candidate keys are also unique identifiers, allowing them to be used in tandem with a primary key to identify a specific row in a table.
- Composite Key – If you have attributes that wouldn’t be unique when taken alone, but can be combined to form a unique identifier for a record, you have a composite key.
- Super Key – This term refers to the collection of attributes that uniquely identify a record, meaning it’s a combination of candidate keys. Just like an employer sifting through job candidates to find the perfect person, you’ll sift through your super key set to choose the ideal primary key amongst your candidate keys.
So, why are keys in DBMS so important?
Keys ensure you maintain data integrity across all of the tables that make up your database. Without them, the relationships between each table become messy hodgepodges, creating the potential for duplicate records and errors that deliver inaccurate reports from the database. Having unique identifiers (in the form of keys) allows you to be certain that any record you pull, and the relationships that apply to that record, are accurate and unrepeated.
Primary Key Essentials
As mentioned, any unique attribute in a table can serve as a primary key, though this doesn’t mean that every unique attribute is a great choice. The following characteristics help you to define the perfect primary key.
Uniqueness
If your primary key is repeatable across records, it can’t serve as a unique identifier for a single record. For example, our student table may have multiple people named “John,” so you can’t use the “Name” attribute to find a specific student. You need something unique to that student, such as the previously mentioned ID number.
Non-Null Values
Primary keys must always contain a value, else you risk losing records in a table because you have no way of calling upon them. This need for non-null values can be used to eliminate some candidates from primary key content. For instance, it’s feasible (though unlikely) that a student won’t have an email address, creating the potential for null values that mean the email address attribute can’t be a primary key.
Immutability
A primary key that can change over time is a key that can cause confusion. Immutability is the term used for any attribute that’s unchanging to the point where it’s an evergreen attribute that you can use to identify a specific record forever.
Minimal
Ideally, one table should have one attribute that serves as its primary key, which is where the term “minimal” comes in. It’s possible for a table to have a composite or super key set, though both create the possibility of confusion and data integrity issues.
The Importance of a Primary Key in DBMS
We can distill the reason why having a primary key in DBMS for each of your tables is important into the following reasons:
- You can use a primary key to identify each unique record in a table, meaning no multi-result returns to your database searches.
- Having a primary key means a record can’t be repeated in the table.
- Primary keys make data retrieval more efficient because you can use a single attribute for searches rather than multiple.
Functions of Primary Keys
Primary keys in DBMS serve several functions, each of which is critical to your DBMS.
Data Identification
Imagine walking into a crowded room and shouting out a name. The odds are that several people (all of whom have the same name) will turn their heads to look at you. That’s basically what you’re doing if you try to pull records from a table without using a primary key.
A primary key in DBMS serves as a unique identifier that you can use to pull specific records. Coming back to the student example mentioned earlier, a “Student ID” is only applicable to a single student, making it a unique identifier you can use to find that student in your database.
Ensure Data Integrity
Primary keys protect data integrity in two ways.
First, they prevent duplicate records from building up inside a single table, ensuring you don’t get multiple instances of the same record. Second, they ensure referential integrity, which is the term used to describe what happens when one table in your database needs to refer to the records stored in another table.
For example, let’s say you have tables for “Students” and “Teachers” in your database. The primary keys assigned to your students and teachers allow you to pull individual records as needed from each table. But every “Teacher” has multiple “Students” in their class. So, your primary key from the “Students” table is used as a foreign key in the “Teachers” table, allowing you to denote the one-to-many relationship between a teacher and their class of students. That foreign key also ensures referential integrity because it contains the unique identifiers for students, which you can look up in your “Students” table.
Data Retrieval
If you need to pull a specific record from a table, you can’t rely on attributes that can repeat across several records in that table. Again, the “Name” example highlights the problem here, as several people could have the same name. You need a unique identifier for each record so you can retrieve a single record from a huge set without having to pore through hundreds (or even thousands) of records.
Best Practices for Primary Key Selection
Now that you understand how primary keys in DBMS work, here are some best practices for selecting the right primary key for your table:
- Choose Appropriate Attributes as Candidates – If the attribute isn’t unique to each record, or it can contain a null value (as is the case with email addresses and phone numbers), it’s not a good candidate for a primary key.
- Avoid Using Sensitive Information – Using personal or sensitive information as a primary key creates a security risk because anybody who cracks your database could use that information for other purposes. Make your primary keys unique, and only applicable, to your database, which allows you to encrypt any sensitive information stored in your tables.
- Consider Surrogate Keys – Some tables don’t have natural attributes that you can use as primary keys. In these cases, you can create a primary key out of thin air and assign it to each record. The “Student ID” referenced earlier is a great example, as students entering a school don’t come with their own ID numbers. Those numbers are given to the student (or simply used in the database that collects their data), making them surrogate keys.
- Ensure Primary Key Stability – Any attribute that can change isn’t suitable for use as a primary key because it causes stability issues. Names, email addresses, phone numbers, and even bank account details are all things that can change, making them unsuitable. Evergreen and unchanging is the way to go with primary keys.
Choose the Right Keys for Your Database
You need to understand the importance of a primary key in DBMS (or multiple primary keys when you have several tables) so you can define the relationships between tables and identify unique records inside your tables. Without primary keys, you’ll find it much harder to run reports because you won’t feel confident in the accuracy of the data returned. Each search may pull up duplicate or incorrect records because of a lack of unique identifiers.
Thankfully, many of the tables you create will have attributes that lend themselves well to primary key status. And even when that isn’t the case, you can use surrogate keys in DBMS to assign primary keys to your tables. Experiment with your databases, testing different potential primary keys to see what works best for you.
Related posts

During the Open Institute of Technology’s (OPIT’s) 2025 Graduation Day, we conducted interviews with many recent graduates to understand why they chose OPIT, how they felt about the course, and what advice they might give to others considering studying at OPIT.
Karina is an experienced FinTech professional who is an experienced integration manager, ERP specialist, and business analyst. She was interested in learning AI applications to expand her career possibilities, and she chose OPIT’s MSc in Applied Data Science & AI.
In the interview, Karina discussed why she chose OPIT over other courses of study, the main challenges she faced when completing the course while working full-time, and the kind of support she received from OPIT and other students.
Why Study at OPIT?
Karina explained that she was interested in enhancing her AI skills to take advantage of a major emerging technology in the FinTech field. She said that she was looking for a course that was affordable and that she could manage alongside her current demanding job. Karina noted that she did not have the luxury to take time off to become a full-time student.
She was principally looking at courses in the United States and the United Kingdom. She found that comprehensive courses were expensive, costing upwards of $50,000, and did not always offer flexible study options. Meanwhile, flexible courses that she could complete while working offered excellent individual modules, but didn’t always add up to a coherent whole. This was something that set OPIT apart.
Karina admits that she was initially skeptical when she encountered OPIT because, at the time, it was still very new. OPIT only started offering courses in September 2023, so 2025 was the first cohort of graduates.
Nevertheless, Karina was interested in OPIT’s affordable study options and the flexibility of fully remote learning and part-time options. She said that when she looked into the course, she realized that it aligned very closely with what she was looking for.
In particular, Karina noted that she was always wary of further study because of the level of mathematics required in most computer science courses. She appreciated that OPIT’s course focused on understanding the underlying core principles and the potential applications, rather than the fine programming and mathematical details. This made the course more applicable to her professional life.
OPIT’s MSc in Applied Data Science & AI
The course Karina took was OPIT’s MSc in Applied Data Science & AI. It is a three- to four-term course (13 weeks), which can take between one and two years to complete, depending on the pace you choose and whether you choose the 90 or 120 ECTS option. As well as part-time, there are also regular and fast-track options.
The course is fully online and completed in English, with an accessible tuition fee of €2,250 per term, which is €6,750 for the 90 ECTS course and €9,000 for the 120 ECTS course. Payment plans are available as are scholarships, and discounts are available if you pay the full amount upfront.
It matches foundational tech modules with business application modules to build a strong foundation. It then ends with a term-long research project culminating in a thesis. Internships with industry partners are encouraged and facilitated by OPIT, or professionals can work on projects within their own companies.
Entry requirements include a bachelor’s degree or equivalency in any field, including non-tech fields, and English proficiency to a B2 level.
Faculty members include Pierluigi Casale, a former Data Science and AI Innovation Officer for the European Parliament and Principal Data Scientist at TomTom; Paco Awissi, former VP at PSL Group and an instructor at McGill University; and Marzi Bakhshandeh, a Senior Product Manager at ING.
Challenges and Support
Karina shared that her biggest challenge while studying at OPIT was time management and juggling the heavy learning schedule with her hectic job. She admitted that when balancing the two, there were times when her social life suffered, but it was doable. The key to her success was organization, time management, and the support of the rest of the cohort.
According to Karina, the cohort WhatsApp group was often a lifeline that helped keep her focused and optimistic during challenging times. Sharing challenges with others in the same boat and seeing the example of her peers often helped.
The OPIT Cohort
OPIT has a wide and varied cohort with over 300 students studying remotely from 78 countries around the world. Around 80% of OPIT’s students are already working professionals who are currently employed at top companies in a variety of industries. This includes global tech firms such as Accenture, Cisco, and Broadcom, FinTech companies like UBS, PwC, Deloitte, and the First Bank of Nigeria, and innovative startups and enterprises like Dynatrace, Leonardo, and the Pharo Foundation.
Study Methods
This cohort meets in OPIT’s online classrooms, powered by the Canvas Learning Management System (LMS). One of the world’s leading teaching and learning software, it acts as a virtual hub for all of OPIT’s academic activities, including live lectures and discussion boards. OPIT also uses the same portal to conduct continuous assessments and prepare students before final exams.
If you want to collaborate with other students, there is a collaboration tab where you can set up workrooms, and also an official Slack platform. Students tend to use WhatsApp for other informal communications.
If students need additional support, they can book an appointment with the course coordinator through Canvas to get advice on managing their workload and balancing their commitments. Students also get access to experienced career advisor Mike McCulloch, who can provide expert guidance.
A Supportive Environment
These services and resources create a supportive environment for OPIT students, which Karina says helped her throughout her course of study. Karina suggests organization and leaning into help from the community are the best ways to succeed when studying with OPIT.

In April 2025, Professor Francesco Derchi from the Open Institute of Technology (OPIT) and Chair of OPIT’s Digital Business programs entered the online classroom to talk about the current state of the Metaverse and what companies can do to engage with this technological shift. As an expert in digital marketing, he is well-placed to talk about how brands can leverage the Metaverse to further company goals.
Current State of the Metaverse
Francesco started by exploring what the Metaverse is and the rocky history of its development. Although many associate the term Metaverse with Mark Zuckerberg’s 2021 announcement of Meta’s pivot toward a virtual immersive experience co-created by users, the concept actually existed long before. In his 1992 novel Snow Crash, author Neal Stephenson described a very similar concept, with people using avatars to seamlessly step out of the real world and into a highly connected virtual world.
Zuckerberg’s announcement was not even the start of real Metaverse-like experiences. Released in 2003, Second Life is a virtual world in which multiple users come together and engage through avatars. Participation in Second Life peaked at about one million active users in 2007. Similarly, Minecraft, released in 2011, is a virtual world where users can explore and build, and it offers multiplayer options.
What set Zuckerberg’s vision apart from these earlier iterations is that he imagined a much broader virtual world, with almost limitless creation and interaction possibilities. However, this proved much more difficult in practice.
Both Meta and Microsoft started investing significantly in the Metaverse at around the same time, with Microsoft completing its acquisition of Activision Blizzard – a gaming company that creates virtual world games such as World of Warcraft – in 2023 and working with Epic Games to bring Fortnite to their Xbox cloud gaming platform.
But limited adoption of new Metaverse technology saw both Meta and Microsoft announce major layoffs and cutbacks on their Metaverse investments.
Open Garden Metaverse
One of the major issues for the big Metaverse vision is that it requires an open-garden Metaverse. Matthew Ball defined this kind of Metaverse in his 2022 book:
“A massively scaled and interoperable network of real-time rendered 3D virtual worlds that can be experienced synchronously and persistently by an effectively unlimited number of users with an individual sense of presence, and with continuity of data, such as identity, history, entitlements, objects, communication, and payments.”
This vision requires an open Metaverse, a virtual world beyond any single company’s walled garden that allows interaction across platforms. With the current technology and state of the market, this is believed to be at least 10 years away.
With that in mind, Zuckerberg and Meta have pivoted away from expanding their Metaverse towards delivering devices such as AI glasses with augmented reality capabilities and virtual reality headsets.
Nevertheless, the Metaverse is still expanding today, but within walled garden contexts. Francesco pointed to Pokémon Go and Roblox as examples of Metaverse-esque words with enormous engagement and popularity.
Brands Engaging with the Metaverse: Nike Case Study
What does that mean for brands? Should they ignore the Metaverse until it becomes a more realistic proposition, or should they be establishing their Meta presence now?
Francesco used Nike’s successful approach to Meta engagement to show how brands can leverage the Metaverse today.
He pointed out that this was a strategic move from Nike to protect their brand. As a cultural phenomenon, people will naturally bring their affinity with Nike into the virtual space with them. If Nike doesn’t constantly monitor that presence, they can lose control of it. Rather than see this as a threat, Nike identified it as an opportunity. As people engage more online, their virtual appearance can become even more important than their physical appearance. Therefore, there is a space for Nike to occupy in this virtual world as a cultural icon.
Nike chose an ad hoc approach, going to users where they are and providing experiences within popular existing platforms.
As more than 1.5 million people play Fortnite every day, Nike started there, first selling a variety of virtual shoes that users can buy to kit out their avatars.
Roblox similarly has around 380 million monthly active users, so Nike entered the space and created NIKELAND, a purpose-built virtual area that offers a unique brand experience in the virtual world. For example, during NBA All-Star Week, LeBron James visited NIKELAND, where he coached and engaged with players. During the FIFA World Cup, NIKELAND let users claim two free soccer jerseys to show support for their favorite teams. According to statistics published at the end of 2023, in less than two years, NIKELAND had more than 34.9 million visitors, with over 13.4 billion hours of engagement and $185 million in NFT (non-fungible tokens or unique digital assets) sales.
Final Thoughts
Francesco concluded by discussing that while Nike has been successful in the Metaverse, this is not necessarily a success that will be simple for smaller brands to replicate. Nike was successful in the virtual world because they are a cultural phenomenon, and the Metaverse is a combination of technology and culture.
Therefore, brands today must decide how to engage with the current state of the Metaverse and prepare for its potential future expansion. Because existing Metaverses are walled gardens, brands also need to decide which Metaverses warrant investment or whether it is worth creating their own dedicated platforms. This all comes down to an appetite for risk.
Facing these types of challenges comes down to understanding the business potential of new technologies and making decisions based on risk and opportunity. OPIT’s BSc in Digital Business and MSc in Digital Business and Innovation help develop these skills, with Francesco also serving as program chair.
Have questions?
Visit our FAQ page or get in touch with us!
Write us at +39 335 576 0263
Get in touch at hello@opit.com
Talk to one of our Study Advisors
We are international
We can speak in: