One-to-one relationship is used when only one entity from a table can be related to only one entity in another table in a database. For example, a country can only have one capital city and capital city can only belong to one country.
To make sure that there’s one-to-one relationship, you have to make sure that in both tables values are unique.
CREATE table Country {
countryId INTEGER PRIMARY KEY,
countryName TEXT,
UNIQUE (countryId)
}
CREATE table CapitalCity {
capitalCityId INTEGER PRIMARY KEY,
capitalCityName TEXT
countryId INTEGER UNIQUE,
FOREIGN KEY (countryId) REFERENCES Country(countryId)
}