Commands to Access Database: For efficient data retrieval, insertion, deletion, updation, etc. The commands in the Database are categorized into three categories, which are as follows:

Query Language: Language using which any user can retrieve some data from the database.

https://media.geeksforgeeks.org/wp-content/uploads/20220728173513/sql.jpg

Note: Relational model is a theoretical framework RDBMS is its implementation.

Relational Algebra: Procedural language with basic and extended operators.

Basic Operator Semantic
σ(Selection) Select rows based on a given condition
π (Projection) Project some columns
X (Cross Product/ Cartesian Product) Cross product of relations, returns m*n rows where m and n are numbers of rows in R1 and R2 respectively.
U (Union) Return those tuples which are either in R1 or R2. Maximum number of rows returned = m+n Minimum number of rows returned = max(m,n)
– (Minus) R1-R2 returns those tuples which are in R1 but not in R2. Maximum number of rows returned = m Minimum number of rows returned = m-n
ρ(Rename) Renaming a relation to another relation.
Extended Operator Semantic
(Intersection) Returns those tuples which are in both relation R1 and R2. Maximum number of rows returned = min(m,n) Minimum number of rows returned = 0
⋈(Conditional Join) Selection from two or more tables based on some condition (Cross product followed by selection)
⋈(Equi Join) It is a special case of conditional join when only an equality condition is applied between attributes.
⋈(Natural Join) In natural join, equality condition on common attributes holds, and duplicate attributes are removed by default. Note: Natural Join is equivalent to the cross product of two relations have no attribute in common and the natural join of a relation R with itself will return R only.
⟕(Left Outer Join) When applying join on two relations R and S, Left Outer Joins gives all tuples of R in the result set. The tuples of R which do not satisfy the join condition will have values as NULL for attributes of S.
⟖(Right Outer Join) When applying join on two relations R and S, Right Outer Joins gives all tuples of S in the result set. The tuples of S which do not satisfy the join condition will have values as NULL for attributes of R.
⟗(Full Outer Join) When applying join on two relations R and S, Full Outer Joins gives all tuples of S and all tuples of R in the result set. The tuples of S which do not satisfy the join condition will have values as NULL for attributes of R and vice versa.
/     (Division Operator) Division operator A/B will return those tuples in A which is associated with every tuple of B.Note: Attributes of B should be a proper subset of attributes of A. The attributes in A/B will be Attributes of A- Attribute of B.

Relational Calculus: Relational calculus is a non-procedural query language. It explains what to do but not how to do it. It is of two types: