Q-1. Write an SQL query to fetch “FIRST_NAME” from Worker table using the alias name as <WORKER_NAME>.
select first name AS WORKER NAME from worker;
–Q-2. Write an SQL query to fetch “FIRST_NAME” from Worker table in upper case.
select UPPER (first_name) from worker;
— Q-3. Write an SQL query to fetch unique values of DEPARTMENT from Worker table.
SELECT distinct department from worker;
— Q-4. Write an SQL query to print the first three characters of FIRST NAME from Worker table.
select substring (first_name, 1, 3) from worker;
— Q-5. Write an SQL query to find the position of the alphabet (‘b’) in the first name column ‘Amitabh’ from Worker table.
select INSTR (first_name, 'B') from worker where first name = 'Jono';
–Q-6. Write an SQL query to print the FIRST_NAME from Worker table after removing white spaces from the right side.
select RTRIM (first_name) from worker;
–Q-7. Write an SQL query to print the DEPARTMENT from Worker table after removing white spaces from the left side.
select LTRIM(first_name) from worker;
–Q-8. Write an SQL query that fetches the unique values of DEPARTMENT from Worker table and prints its length.
select distinct department, LENGTH (department) from worker;
–Q-9. Write an SQL query to print the FIRST_NAME from Worker table after replacing ‘a’ with ‘A’.
select REPLACE (first name, 'a', 'A') from worker;
–Q-10. Write an SQL query to print the FIRST NAME and LAST_NAME from Worker table into a single column COMPLETE NAME. A space char should separate them.
select CONCAT (first_name,' ', last_name) AS COMPLETE NAME from worker;
–Q-11. Write an SQL query to print all Worker details from the Worker table order by FIRST NAME Ascending.
select from worker ORDER by first_name;
–Q-12. Write an SQL query to print all Worker details from the Worker table order by
FIRST_NAME Ascending and DEPARTMENT Descending.
select * from worker order by first_name, department DESC;