Page 177 - IT-802_class_12
P. 177
Example:
To retrieve names of all the teachers starting from letter ‘R’.
SELECT Emp_Name
FROm EmpLOyEE_DETAiLS
WHERE Emp_Name LiKE “R%”
Output:
+-------------+
| Emp_Name |
+-------------+
| RADHA_SiNHA |
| RAVi_yADAV |
+-------------+
1.11 Delete coMManD
The DELETE command is used to delete a record or all the records from a table. If we want to delete a particular record
from a table, we need to use the WHERE clause with the DELETE command. For example,
DELETE FROm EmpLOyEE_DETAiLS
WHERE ADDRESS = ‘RANCHi’;
If we skip the WHERE clause, all the records from a table will be deleted. For example,
DELETE FROm EmpLOyEE_DETAiLS;
1.12 sQl Joins in taBle
A join clause is used to join two or more table rows based on the associated columns between them.
Consider the two tables below:
EmpLOyEE and EmpLOyEE_DETAiLS
+--------+-------------+--------+
| Emp_iD | Emp_NAmE | SALARy |
+--------+-------------+--------+
| 03 | NEHA_DAS | 18000 |
| 04 | RADHA_SiNHA | 25000 |
| 06 | RAVi_yADAV | 28000 |
+--------+-------------+--------+
+-------------+----------------+-----------------+---------------+---------+--------+
| Emp_NAmE | Emp_DEpARTmENT | Emp_DESiGNATiON | DATE_OF_BiRTH | ADDRESS | Emp_iD |
+-------------+----------------+-----------------+---------------+---------+--------+
| NEHA_DAS | ADmiN | RECEpTiONiST | 2005-11-03 | RANCHi | 03 |
| RADHA_SiNHA | ACADEmiCS | mATHS TEACHER | 2005-01-03 | pATNA | 04 |
| RAVi_yADAV | ACADEmiCS | SCiENCE TEACHER | 2005-06-08 | pATNA | 06 |
+-------------+----------------+-----------------+---------------+---------+--------+
1.12.1 Inner Join
The INNER JOIN keyword selects all rows from both the tables as long as the condition is satisfied. This keyword will
create the result-set by combining all rows from both the tables where the condition satisfies i.e value of the common
field will be the same.
Syntax:
SELECT table1.column1, table1.column2, table2.column1,....
FROm table1
iNNER JOiN table2
ON table1.matching_column = table2.matching_column;
Database Concepts—RDBMS Tool 175

