What is a simple key in a dbms?

In a database table, a simple key is just a single attribute (which is just a column) that can uniquely identify a row. So, any single column in a table that can uniquely identify a row is a simple key. The reason it’s called a simple key is because of the fact that it is simple in the sense that it’s just composed of one column (as opposed to multiple columns) and that’s it.




Example of a simple key

Let’s go through an example of a simple key. Consider a table called Employees. If every employee has a unique ID and a column called EmployeeID, then the EmployeeID column would be considered a simple key because it’s a single column that can uniquely identify every row in the table (where each row is a separate employee). Simple isn’t it?

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.

  • Gini

    does it mean simple keys also can’t have null value??

  • Kankan

    All simple keys are primary keys??
    Simple keys can hold null values but primary key can’t..
    Please clear me.

  • Gomathi kandhasamy

    primary key is otherwise termed as simple key.

  • BHS

    Yes all of them would be simple keys. so emailId and mobileNumber can both be listed as simpel keys. you have to understand that all simple keys are primary keys, but not all primary keys can be simple keys. Hope that makes sense.

  • Sagar Thatte

    If you recollect, a primary key can be composed of one or more columns. A simple key is a primary key, that consists of just one column.

  • prashant patel

    @be1c04fede43fa421ce6c1c6136a4802:disqus you mean the key consist of single attribute is simple key? what if more than one keys are single attributed, would all be simple keys ??

  • Mounika

    primary key is usually two types. Simple primary key and compound primary key. So simple key is a primary key.

  • prashant patel

    still not clear. . . every primary key do the same , so whats the difference in primary key and a simple key ?? 😮