How to find all Employee records containing a Specific Word regardless case-sensitive in SQL
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.
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.
Step-1: Creating a database –
Creating a database using the following SQL query as follows.
syntax: CREATE DATABASE database_name;
Step-2: Using the database –
Using the database company as follows.
syntax: USE database_name;
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.
Step-5: Verifying columns and data types –
Columns and their data types by DESCRIBE query as follows.
syntax: DESCRIBE table_name;
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);
Step-7: Verifying inserted data –
Check the inserted data in the database using the select query as follows.
syntax: SELECT * FROM table_name;
Let’s understand the concept with the help of examples as well for better understanding.
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.
SELECT* FROM table_name WHERE column_name LIKE 'PATTERN';
Selecting data Querying –
SELECT* FROM employee WHERE dept_name LIKE '%DEVELOPER';
Here in this table, all the records of an employee with the developer as dept name are obtained without considering the case.
Query to obtain all employee names with the developer as dept_name with case insensitive as follows.
Here in this example, all the names of an employee with a developer are obtained without considering the case.
Please Login to comment...