Tricky SQL questions on Strings | Like Operator | Substring Function | CHARINDEX | IQBees

Tricky SQL questions on Strings | Like Operator | Substring Function | CHARINDEX | IQBees

IQBees

3 года назад

3,842 Просмотров

Hello Friends,

Most commonly asked question is about Strings in SQL ( Like Operator, Substring , CharIndex ). I think most of the people knows about these. But this question is quite tricky ..if we are good at basics we will be able to crack.

Question : Write a SQL query to find the Name where Second position of the character should be an vowel (a,e,i,o,u ) ?
Ans: SELECT * FROM EmployeeData
WHERE Name LIKE '_[aeiou]%';

You can also achieve the same by substring, charindex. Use substring in case of multiple words search

LIKE operator is used in a WHERE clause to search for a specified pattern in a column

CHARINDEX function searches for a substring in a string, and returns the position. If the substring is not found, this function returns 0.

substring :Required. The substring to search for
string: Required. The string to be searched
start: Optional. The position where the search will start (if you do not want to start at the beginning of string). The first position in string is 1

Syntax
CHARINDEX(substring, string, start)

Substring : Function extracts some characters from a string.

Syntax : SUBSTRING(string, start, length)

string Required. The string to extract from
start Required. The start position. The first position in string is 1
length Required. The number of characters to extract. Must be a positive number

If you need personal help in SQL, Mock interviews, You can contact me

Regards,
IQBees

Tricky SQL questions on Strings | Like Operator | Substring Function | CHARINDEX | IQBees

#SQL #SQLQuery #SQLInterviewQuestion

sql interview questions,sql faq,sql interview questions and answers,IQBees,Tricky SQL questions on Strings,Like Operator,Substring function,CHARINDEX,substring syntax,substring interview questions,sql query,sql tutorial,interview questions sql,tricky interview questions sql strings,top sql interview questions, like operator in sql server, pattern matching

Тэги:

#sql_interview_questions #sql_faq #sql_interview_questions_and_answers #IQBees #Tricky_SQL_questions_on_Strings #Like_Operator #Substring_function #CHARINDEX #substring_syntax #substring_interview_questions #sql_query #sql_tutorial #interview_questions_sql #tricky_interview_questions_sql_strings #top_sql_interview_questions #like_operator_in_sql_server #pattern_matching #sql_server #sql_queries_interview_questions_and_answers
Ссылки и html тэги не поддерживаются


Комментарии:

@awesomeboyz2974
@awesomeboyz2974 - 07.06.2021 08:07

Short, Simple and Clear explanation..Really liked it so much.👍👍

Ответить
@rahulupadhyay7014
@rahulupadhyay7014 - 06.06.2021 09:32

Good one .

Ответить
@poetry5960
@poetry5960 - 06.06.2021 09:09

Simple & impactful explanation👍👍

Ответить
@knowledgewithsolanki66
@knowledgewithsolanki66 - 06.06.2021 09:08

Nice vedio

Ответить
@sachinkumar3520
@sachinkumar3520 - 06.06.2021 08:39

Great sarkar

Ответить
@aksingh3449
@aksingh3449 - 06.06.2021 08:34

Nice explanation, everyone should watch it👍👍

Ответить
@Aalam_Ansari_
@Aalam_Ansari_ - 06.06.2021 08:10

🙌🙌❤❤

Ответить
@dancingstar6207
@dancingstar6207 - 06.06.2021 08:08

Nice video and helpful

Ответить
@amansehgal7460
@amansehgal7460 - 06.06.2021 07:42

same can be done in statement using like _[aeiou]%

Ответить
@kalashtyagi5197
@kalashtyagi5197 - 06.06.2021 07:38

Very helpful vedio keep it up👍

Ответить
@swatityagi5731
@swatityagi5731 - 05.06.2021 18:30

Such a nice video...keep it up.

Ответить