Open In App

How to find all Employee records containing a Specific Word regardless case-sensitive in SQL

Last Updated : 07 Apr, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will cover how to find all Employee records containing a Specific Word regardless of case-sensitive in SQL and will discuss steps by steps.  

Introduction :
We will discuss, how to find all employee records containing a specific word regardless of the case-sensitive. We create the database employee and check for the following query step by step. Considering this table we find all employee records with the developer as the case-insensitive word as follows.

 dept_id emp_name dept_name emp_age
 60001 WARNER FRONT-END Developer

26

 60002 CRISTIE GAME deVeLoper

30

 60003 RANGA UX deVeLoper

 30 

 60004 RANGA UX deVeLoper

 30 

 60005 PRAD BACKEND DEVeLoper

40

Step-1: Creating a database –
Creating a database using the following SQL query as follows.

syntax:
CREATE DATABASE database_name;

Output :

Step-2: Using the database –
Using the database company as follows.

syntax:
USE database_name;

Output :

Step-3: Adding a table –
Adding a table employee into a database company as follows.

syntax:
CREATE TABLE table_name
( column_name1 data_type1 ,
column_name2 data_type2 ,
column_name3 data_type3 ,
.
.
column_nameN data_typeN , );     

Step-4: Creating a table –
Creating a table employee with columns (dept_id,emp_name,dept_name,emp_age) into a database company as follows.

Output :

Step-5: Verifying columns and data types –
Columns and their data types by DESCRIBE query as follows.

syntax:
DESCRIBE table_name;

Output :

Step-6: Inserting rows into a table –
Inserting rows into a table employee by using the following SQL query as follows.

syntax:
INSERT INTO table_name  VALUES(column1_data,column2_data,......columnN_data);

Output :

Step-7: Verifying inserted data –
Check the inserted data in the database using the select query as follows.

syntax:
SELECT * FROM table_name;

Output :

Examples :
Let’s understand the concept with the help of examples as well for better understanding.

Example-1 :
As observed in the table the developer word is case-insensitive but all the employee records with the developer should be retrieved so the query to that is as follows.

Syntax :

SELECT*
FROM table_name
WHERE column_name LIKE 'PATTERN';

Selecting data Querying –

SELECT* 
FROM employee
WHERE dept_name LIKE '%DEVELOPER';

Output :
Here in this table, all the records of an employee with the developer as dept name are obtained without considering the case.

Example-2 :
Query to obtain all employee names with the developer as dept_name with case insensitive as follows.

Output :
Here in this example, all the names of an employee with a developer are obtained without considering the case.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads