-
Notifications
You must be signed in to change notification settings - Fork 1
/
InterviewQuestions.sql
15 lines (10 loc) · 1.15 KB
/
InterviewQuestions.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
PRIMARY KEY:
The PRIMARY KEY constraint uniquely identifies each row in a table. It must contain UNIQUE values and has an implicit NOT NULL constraint.
A table in SQL is strictly restricted to have one and only one primary key, which is comprised of single or multiple fields (columns).
FOREIGN KEY:
A FOREIGN KEY comprises of single or collection of fields in a table that essentially refers to the PRIMARY KEY in another table. Foreign key constraint ensures referential integrity in the relation between two tables.
The table with the foreign key constraint is labeled as the child table, and the table containing the candidate key is labeled as the referenced or parent table.
JOINS:
The SQL Join clause is used to combine records (rows) from two or more tables in a SQL database based on a related column between the two.
NORMALIZATION:
Normalization represents the way of organizing structured data in the database efficiently. It includes the creation of tables, establishing relationships between them, and defining rules for those relationships. Inconsistency and redundancy can be kept in check based on these rules, hence, adding flexibility to the database.