Basic Clause; simple and advance filter Flashcards
like, upper,lower initcap, TRIM, LTRIM, RTRIM, LPAD,RPAD
Write a query to display first_name in uppercase, last_name in lower case, EACH word first character of Job_ID into uppercase and rest in lowercase from employees
Select Upper(First_name), lower(last_name), initcap(Job_ID) from employees;
Write a query to display all records from employees table, only those records whose first_name starts with ‘A’
Select * from employees
where first_name like ‘A%’;
Write a query to display all records from employees table; only those records whose last_name ends with ‘a’;
select * from employees where last_name like ‘%A’;
Write a query to display all records from employees table, only those records whose first_name having two ‘o’.
Select * from employees where first_name like ‘%oo%’;
Write a query to display all records from employees table; only those records whose first_name not start with ‘S’;
Select * from employees
where first_name not like ‘S%’;
Write a query to display all records from employees table, only those records whose last_name start with ‘A’ and ends ‘s’
Select * from employees
where last_name like ‘A%s’;
Write a query to display all records from employees table, only those records whose first_name having ‘a’ at second position OR last_name having ‘s’ at second last position
Select * from employees
where first_name like ‘a%’ OR Last_name like ‘%s’;
Write a query to remove left side space from the given string ‘ vaannii’
select LTrim (‘ Vaaniii’) from dual;
Write a query to remove @ from left side from given string ‘@@@vaanii’
select Ltrim( ‘@@@Vaanii’,’@’) from dual;
Write a query to remove @ from both side from given string
select trim ( ‘@’ from ‘@@@Vaanii@@@’) from dual;
Write a Query to format the below string which should be 10 character long; if it is having 10 character then add ‘$’ on right side ‘Vaannii’
Select rpad(‘Vaanii’,10,’$’) from dual;
Write a query to display all records from employees table, only show those records whose department_ID is not in 10,20,30
Select * from employees where department_ID NOT in (10,20,30) ;