Pattern Matching LIKE '%great%' : Like « Select Query « Oracle PL / SQL






Pattern Matching LIKE '%great%'

    
SQL>
SQL> CREATE TABLE SAT (
  2     StudentID  INT NOT NULL,
  3     ExamID     INT NOT NULL,
  4     Mark       INT,
  5     IfPassed   SMALLINT,
  6     Comments   VARCHAR(255),
  7     CONSTRAINT PK_SAT PRIMARY KEY (StudentID, ExamID));

Table created.

SQL>
SQL>
SQL> INSERT INTO SAT (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (1,1,55,1,'Satisfactory');

1 row created.

SQL> INSERT INTO SAT (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (1,2,73,1,'Good result');

1 row created.

SQL> INSERT INTO SAT (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (2,3,44,1,'Hard');

1 row created.

SQL> INSERT INTO SAT (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (2,5,39,0,'Simple');

1 row created.

SQL> INSERT INTO SAT (StudentID,ExamID,Mark,IfPassed) VALUES (2,6,63,1);

1 row created.

SQL>
SQL> SELECT StudentID, ExamID, Mark, Comments FROM SAT
  2  WHERE Comments LIKE '%great%';

no rows selected

SQL>
SQL>
SQL> drop table SAT;

Table dropped.

   
    
    
    
  








Related examples in the same category

1.A function using the LIKE operator to return a phone number's area code
2.Like with '__' (Any two characters)
3.Like with '_' and '%'
4.Use two '%' in Like statement
5.Using a NOT operator with like
6.Convert varchar value to upper case and then use like operator
7.Is Like case sensitive
8.Use % in word ending
9.Use two % signs in one like
10.Use two % signs in like
11.Like '%' function with varchar2 type
12.Like with % on both sides
13.Second letter is A
14.Create pattern dynamically and use it in like statement
15.Using Pattern Matching LIKE '____ %'
16.comments like '%0\%%' escape '\'
17.Escape \
18.Description has 'SQL' substring