Database Concept
DBMS ER Model
DBMS Relational model
- DBMS Codd’s 12 rule
- DBMSBasic Concepts
- DBMS Relational Algebra
- DBMS Relational Calculus
- DBMS ER Model to Relational Model
- DBMS Types of Database key
DBMS Normalization
- DBMS Introduction to Normalization
- DBMS First Normal Form (1NF)
- DBMS Second Normal Form (1NF)
- DBMS Third Normal Form (3NF)
- DBMS Boyce-Codd Normal Form (BCNF)
- DBMS Fourth Normal Form (4NF)
- DBMS Fifth Normal Form (5NF)
DBMS Basic SQL
DBMS DML Command
DBMS DCL Command
- All DCL Command
- SELECT query
- WHERE clause
- LIKE clause
- ORDER BY clause
- Group BY clause
- Having clause
- DISTINCT keyword
- AND & OR operator
- DIVISION operator
Advanced SQL
LIKE
clause is used in the condition in SQL query with the WHERE
clause. LIKE
clause compares data with an expression using wildcard operators to match pattern given in the condition.
Wildcard operators
There are two wildcard operators that are used in LIKE
clause.
- Percent sign
%
: represents zero, one or more than one character. - Underscore sign
_
: represents only a single character.
Example of LIKE
clause
Consider the following Student table.
s_id | s_Name | age |
---|---|---|
101 | Adam | 15 |
102 | Alex | 18 |
103 | Abhi | 17 |
SELECT * FROM Student WHERE s_name LIKE 'A%';
The above query will return all records where s_name starts with character ‘A’.
s_id | s_Name | age |
---|---|---|
101 | Adam | 15 |
102 | Alex | 18 |
103 | Abhi | 17 |
Using _
and %
SELECT * FROM Student WHERE s_name LIKE '_d%';
The above query will return all records from Student table where s_name contain ‘d’ as second character.
s_id | s_Name | age |
---|---|---|
101 | Adam | 15 |
Using %
only
SELECT * FROM Student WHERE s_name LIKE '%x';
The above query will return all records from Student table where s_name contain ‘x’ as last character.
s_id | s_Name | age |
---|---|---|
102 | Alex | 18 |