To fetch the result without using complete string. Better will be understood with below examples :
Example : Consider the following table Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
01 | chandan | E_01 | 25000 |
02 | adhiraj | E_02 | 30000 |
03 | raghu | E_03 | 35000 |
04 | raghunath | E_04 | 36000 |
05 | Alax | E_04 | 40000 |
Select * from Salary where Emp_name like "%ndan"
Result: Records starting from any character but followed by 'ndan' will appear Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
01 | chandan | E_01 | 25000 |
Select * from Salary where Emp_name like "ra%"
Result: All the records staring from 'ra' character will appear Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
03 | raghu | E_03 | 35000 |
04 | raghunath | E_04 | 36000 |
Select * from Salary where Emp_name like "-raj"
Result: Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
02 | adhiraj | E_02 | 30000 |
05 | Alax | E_04 | 40000 |
Select * from Salary where Emp_name like "[a-c]%"
Result: Records starting from from any 'a, b, c' charcater will appear. Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
01 | chandan | E_01 | 25000 |
02 | adhiraj | E_02 | 30000 |
05 | Alax | E_04 | 40000 |
Select * from Salary where Emp_name = "[!ar]%"
Result: All the records starting from letter a, r will NOTappear Table: SalaryEmp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
01 | chandan | E_01 | 25000 |
No comments:
Post a Comment