I have question that I can't find anywhere on the internet answer for. It's about database design.
What is the difference between FPK and FK? I know PK.
But I don't uderstand fully idea of FK/FPK keys, whenever we have FK or FPK.
I guess you you refer to Foreign Keys and Primary Keys. Here is an interesting article that explains Keys: https://www.essentialsql.com/what-is-the-difference-between-a-primary-key-and-a-foreign-key/
A Foreign Primary Key can be used when you have a table that is related 1:1 but dows not have related records for every record in the main table.
Example: Lets say you have a table T1 with information and you have unique information records for some records but not all in T1.
So you decide to store the data in another table T2 in order to not have columns with hundreds of empty cells.
As these are unique records (1:1 between T1 and T2) T2 can either have an own primary key and a foreign key or combine them into 1 field using the foreign key as primary id (T2.T1_id):
CREATE TABLE `T1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `T2` (
`T1_id` int(11) NOT NULL,
`specinfo` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`T1_id`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`T1_id`) REFERENCES `T1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);