Sample Table Employee Employee - Id First - Name Last - Name Salary Joining - Date Department
The document provides sample SQL queries and tables to practice basic SQL skills. It includes sample Employee, Bonus, and Title tables with seeded data. It then provides 20 questions asking to write SQL queries to retrieve or filter data from the Employee table based on conditions on columns like name, department, salary, and date.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
499 views6 pages
Sample Table Employee Employee - Id First - Name Last - Name Salary Joining - Date Department
The document provides sample SQL queries and tables to practice basic SQL skills. It includes sample Employee, Bonus, and Title tables with seeded data. It then provides 20 questions asking to write SQL queries to retrieve or filter data from the Employee table based on conditions on columns like name, department, salary, and date.
Once above SQL would run, you’ll see a result similar
to the one attached below. Q-1. Write an SQL query to fetch “FIRST_NAME” from Employee table using the alias name as <EMPLOYEE_NAME>.
Q-2. Write an SQL query to fetch “FIRST_NAME” from
EMPLOYEE table in upper case.
Q-3. Write an SQL query to fetch unique values
of DEPARTMENT from EMPLOYEE table. Ans.
Q-4. Write an SQL query to print the first three
characters of FIRST_NAME from EMPLOYEE table.
Q-5. Write an SQL query to find the position of the
alphabet (‘a’) in the first name column ‘Amitabh’ from EMPLOYEE table.
Q-6. Write an SQL query to print the FIRST_NAME
from EMPLOYEE table after removing white spaces from the right side.
Q-7. Write an SQL query to print the DEPARTMENT
from EMPLOYEE table after removing white spaces from the left side.
Q-8. Write an SQL query that fetches the unique values
of DEPARTMENT from EMPLOYEE table and prints its length.
Q-9. Write an SQL query to print the FIRST_NAME
from EMPLOYEE table after replacing ‘a’ with ‘A’. Ans. Q-10. Write an SQL query to print the FIRST_NAME and LAST_NAME from EMPLOYEE table into a single column COMPLETE_NAME. A space char should separate them.
Q-11. Write an SQL query to print all EMPLOYEE
details from the EMPLOYEE table order by FIRST_NAME Ascending.
Q-12. Write an SQL query to print all EMPLOYEE
details from the EMPLOYEE table order by FIRST_NAME Ascending and DEPARTMENT Descending.
Q-13. Write an SQL query to print details for
EMPLOYEEs with the first name as “Vipul” and “Satish” from EMPLOYEE table.
Q-14. Write an SQL query to print details of
EMPLOYEEs excluding first names, “Vipul” and “Satish” from EMPLOYEE table.
Q-15. Write an SQL query to print details of
EMPLOYEEs with DEPARTMENT name as “Admin”.
Q-16. Write an SQL query to print details of
the EMPLOYEEs whose FIRST_NAME contains ‘a’.
Q-17. Write an SQL query to print details of the
EMPLOYEEs whose FIRST_NAME ends with ‘a’.
Q-18. Write an SQL query to print details of the
EMPLOYEEs whose FIRST_NAME ends with ‘h’ and contains six alphabets. Q-19. Write an SQL query to print details of the EMPLOYEEs whose SALARY lies between 100000 and 500000.