DBMS - Quick reference - 9

41. What is third normal form in the DBMS?
The entity should be considered already in second normal form, and no column entry should be dependent on any other entry (value) other than the key for the table.

42. What is 1NF in the DBMS?
First normal form (1NF) is a property of a relation in a relational database. A relation is in first normal form if and only if the domain of each attribute contains only atomic (indivisible) values, and the value of each attribute contains only a single value from that domain.
First normal form enforces these criteria.
Eliminate repeating groups in individual tables.
Create a separate table for each set of related data.
Identify each set of related data with a primary key.

43. What are the main differences between Primary key and Unique Key?
1) Unique key in a table can be null. Atleast one but the primary key cannot be null in any table in a relational database.
2) Primary key can be a combination of more than one unique keys in the same table
3) There can be only one primary key per table in relation database. But there can be more than one unique key per table.

44. Explain Entity, Entity Type, and Entity Set in DBMS?
Entity means anything with distinct and independent existence.
Entity type is basically a collection of entities that have the similar attributes.
Entity set is the collection is a set of all entities of the similar type. It is a set of entities of same entity type. so a set of one or more entities of Student Entity type is an Entity Set.
Technically speaking the phrase entity type is better, because a set is normally defined as a fixed collection where membership does not change in time.

45. How to get the alternate rows or records from table
select name, age, row_number() over(partition by age order by age) as x  from #person order by x, age desc;
1 2 3 4 5 6 7 8 9 10