Illustrate the end result of the above declaration by using the following snapshot. Use the following statement to implement not like operator. Suppose we need to find all employees whose names do not start with po. This operator is totally opposite from like. So you can use % sign to find out Alex’s employee but also use % and _ sign to find out ales user. We can combine percentage and underscore signs to get the desired patternĬonsidering the above example, we need to find Alex’s employee name, and we know the last three characters, like lex. Let’s see the example, consider the following statement. By using the following syntax, we return the ex character. Illustrate the end result of the above declaration by using the use of the following snapshot.Ĭonsider another example, suppose we need to find those employee names that end with an ex. select emp_id, emp_name fromĮxplanation: With the help of the above statement, we find those names start with ‘bo’ characters which we use to select and where clause to implement the above statement, and we return two-column emp_id and emp_name. We use the following statement to find out employee names like bo. We need to find out the employee’s name, and you do not remember the exact name of the employee, but you remember the first two characters, for example, bo. _(Underscore sign): This sign is used to match any single character.Ĭonsider the above example.%(Percentage sign): This sign matches any sequence of characters the character size may be zero or more.So you can use the like an operator that PostgreSQL provides. So how can we find the exact name of an employee? You may find names in emp_info tables, but it is time-consuming. But you remember the first two characters like bo. Suppose we need to find out the employee’s name you do not remember her exact name. Now see how we can use a like operator to find the matching pattern using the below methods. Illustrate the end result of the above declaration by using the use of the following snapshot. insert into emp_info (emp_id, emp_name, emp_age, address, salary) valuesįor selecting the table emp_info, we will use the following: select * from emp_info Now we will be inserting values into the table. So first, we create a table by using the following statement.
0 Comments
Leave a Reply. |