Candidate key vs Primary key in a relational schema

Primary Keys

Rules for primary keys:

  • There can be no missing values( ie. Not Null) for Primary Keys. If the Primary Key is composed of multiple attributes, each of those attributes must have a value for each instance.
  • The Primary Key is immutable.i.e., once created the value of the Primary Key cannot be changed.
  • If the Primary Key consists of multiple attributes, none of these values can be updated.
The solutions to the assignment are given below:
Question 1: Identify the primary key of the relation Car.Answer: Serial noQuestion 2: Identify the foreign key of the relation Sale.Answer: Serial noQuestion 3: How many constraint types are there in relation Sale?Answer: 2 constraints : Primary Key and Foreign Key

Semantic Integrity

Semantic Constraints

  • Integers (short integer, integer, long integer)
  • Real numbers (float and double precision float)
  • Characters
  • Booleans
  • Fixed-length strings and variable length strings
  • Date, time, timestamp
  • Money
  • Other special data types




Passionate author, strategic investor, financial advisor

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Keep your exclamations safe

Orchestrating the Modern Workday with Slack

GameDevHQ Intensive Training Week 08 Recap Final Week 📝

Kubernetes vs Docker vs OpenShift vs ECS vs Jenkins vs Terraform

Hive BP November Update — Improving our Products

Key Elements of NFT Evaluation Value_Storage Mechanism

Introducing UI2CODE: An Automatic Flutter UI Code Generator

Intro to the World of Augmented Reality With Unity3D and Vuforia

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya B

Aditya B

Passionate author, strategic investor, financial advisor

More from Medium

SQL Queries Interview Questions


Domain Logic , Data Gateways and Mapping relationships

Harry Potter and the relational database management system.