Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

SQL_251024

The document contains a SQL test for Eglobal, featuring a Worker table with various employee details and a Bonus table with bonus information. It includes a series of SQL query questions aimed at extracting and manipulating data from the Worker table, such as fetching names, salaries, and department details. Additionally, it covers PL/SQL concepts, including variable declarations, control structures, and triggers.

Uploaded by

vmlatha_5
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

SQL_251024

The document contains a SQL test for Eglobal, featuring a Worker table with various employee details and a Bonus table with bonus information. It includes a series of SQL query questions aimed at extracting and manipulating data from the Worker table, such as fetching names, salaries, and department details. Additionally, it covers PL/SQL concepts, including variable declarations, control structures, and triggers.

Uploaded by

vmlatha_5
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Eglobal – SQL Test

WORKER_ FIRST_NAM LAST_NAME SALARY JOINING_DATE DEPART WORKER_REF_I WORKER_TITLE AFFECTED_FROM


ID E MENT D

WORKER
TITLE
001 Monika Arora 100000 2021-02-20 09:00:00 HR 1 Manager 2023-02-20 00:00:00

002 Niharika Verma 80000 2021-06-11 09:00:00 Admin 2 Executive 2023-06-11 00:00:00

003 Vishal Singhal 300000 2021-02-20 09:00:00 HR 8 Executive 2023-06-11 00:00:00

004 Amitabh Singh 500000 2021-02-20 09:00:00 Admin 5 Manager 2023-06-11 00:00:00

005 Vivek Bhati 500000 2021-06-11 09:00:00 Admin 4 Asst. Manager 2023-06-11 00:00:00

006 Vipul Diwan 200000 2021-06-11 09:00:00 Account 7 Executive 2023-06-11 00:00:00

007 Satish Kumar 75000 2021-01-20 09:00:00 Account 6 Lead 2023-06-11 00:00:00

008 Geetika Chauhan 90000 2021-04-11 09:00:00 Admin 3 Lead 2023-06-11 00:00:00

BONUS

WORKER_RE
BONUS_DATE BONUS_AMOUNT
F_ID
1 2023-02-20 00:00:00 5000
2 2023-06-11 00:00:00 3000
3 2023-02-20 00:00:00 4000
1 2023-02-20 00:00:00 4500

Q-1. Write an SQL query to fetch “FIRST_NAME” from the Worker table using the alias name <WORKER_NAME>.

Q-2. Write an SQL query to fetch “FIRST_NAME” from the Worker table in upper case.

Q-3. Write an SQL query to fetch unique values of DEPARTMENT from the Worker table.

Q-4. Write an SQL query to print the first three characters of FIRST_NAME from the Worker table.

Q-5. Write an SQL query to find the position of the alphabet (‘a’) in the first name column ‘Amitabh’ from the Worker table.

Q-6. Write an SQL query to print the FIRST_NAME from the Worker table after removing white spaces from the right side.

Q-7. Write an SQL query to print the DEPARTMENT from the Worker table after removing white spaces from the left side.

Q-8. Write an SQL query that fetches the unique values of DEPARTMENT from the Worker table and prints its length.

Q-9. Write an SQL query to print the FIRST_NAME from the Worker table after replacing ‘a’ with ‘A’.

Q-10. Write an SQL query to print the FIRST_NAME and LAST_NAME from the Worker table into a single column COMPLETE_NAME. A space char should separate
them.

Q-11. Write an SQL query to print all Worker details from the Worker table order by FIRST_NAME Ascending.

Q-12. Write an SQL query to print all Worker details from the Worker table order by FIRST_NAME Ascending and DEPARTMENT Descending.

Q-13. Write an SQL query to print details for Workers with the first names “Vipul” and “Satish” from the Worker table.

Q-14. Write an SQL query to print details of workers excluding first names, “Vipul” and “Satish” from the Worker table.

Q-15. Write an SQL query to print details of Workers with DEPARTMENT name as “Admin”.

Q-16. Write an SQL query to print details of the Workers whose FIRST_NAME contains ‘a’.

Q-17. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’.

Q-18. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘h’ and contains six alphabets.

Q-19. Write an SQL query to print details of the Workers whose SALARY lies between 100000 and 500000.

Q-20. Write an SQL query to print details of the Workers who joined in Feb 2021.

Q-21. Write an SQL query to fetch the count of employees working in the department ‘Admin’.

Q-22. Write an SQL query to fetch worker names with salaries >= 50000 and <= 100000.

Q-23. Write an SQL query to fetch the number of workers for each department in descending order.
Q-24. Write an SQL query to print details of the Workers who are also Managers.

Q-25. Write an SQL query to fetch duplicate records having matching data in some fields of a table.

Q-26. Write an SQL query to show only odd rows from a table.

Q-27. Write an SQL query to show only even rows from a table.

Q-28. Write an SQL query to clone a new table from another table.

Q-29. Write an SQL query to fetch intersecting records of two tables.

Q-30. Write an SQL query to show records from one table that another table does not have.

Q-31. Write an SQL query to show the current date and time.

Q-32. Write an SQL query to show the top n (say 10) records of a table.

Q-33. Write an SQL query to determine the nth (say n=5) highest salary from a table.

Q-34. Write an SQL query to determine the 5th highest salary without using the TOP or limit method.

Q-35. Write an SQL query to fetch the list of employees with the same salary.

Q-36. Write an SQL query to show the second-highest salary from a table.

Q-37. Write an SQL query to show one row twice in the results from a table.

Q-38. Write an SQL query to fetch intersecting records of two tables.

Q-39. Write an SQL query to fetch the first 50% of records from a table.

Q-40. Write an SQL query to fetch the departments that have less than five people in them.

Q-41. Write an SQL query to show all departments along with the number of people in there.

Q-42. Write an SQL query to show the last record from a table.

Q-43. Write an SQL query to fetch the first row of a table.

Q-44. Write an SQL query to fetch the last five records from a table.

Q-45. Write an SQL query to print the names of employees having the highest salary in each department.

Q-46. Write an SQL query to fetch three max salaries from a table.

Q-47. Write an SQL query to fetch three min salaries from a table.

Q-48. Write an SQL query to fetch nth max salaries from a table.

Q-49. Write an SQL query to fetch departments along with the total salaries paid for each of them.

Q-50. Write an SQL query to fetch the names of workers who earn the highest salary.

51. PL/SQL is a –

A. Brick Structured Language


B. Block Structured Language
C. Banner Structured Language
D. Build Structured Language
52. What is TRUE about PL/SQL functionalities?

A. Conditions and loops are fundamental elements of procedural languages like PL/SQL.
B. Various types and variables can be declared, as can procedures and functions, as well as types and variables of those types.
C. Arrays can be used with it as well as handling exceptions (runtime errors).
D. All of the above

53. Which of the following is/are TRUE about PL/SQL Variables?

A. Variables serve as a means for programmers to temporarily store data during code execution.
B. PL/SQL programs benefit from its use.
C. There is nothing special about it other than being the name of a storage area.
D. All of the above
54. The correct syntax to declare PL/SQL variable is –

A. variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value]


B. datatype [CONSTANT] variable_name [NOT NULL] [:= | DEFAULT initial_value]
C. variable_name [CONSTANT] datatype [NULL] [:= | DEFAULT initial_value]
D. datatype [CONSTANT] variable_name [NULL] [:= | DEFAULT initial_value]
55. Which of the following is correct syntax of IF statement?

A. IF-THEN statement
B. IF-THEN-ELSE statement
C. IF-THEN-ELSIF statement
D. All of the above
56. Which of the following pass parameters can be referenced by procedure?

A. IN, OUT
B. OUT, INOUT
C. IN, INOUT
D. None of the above
57. A __________ is a special kind of a store procedure that executes in response to certain actions.

A. Procedures
B. Triggers
C. Functions
D. None of the mentioned
58. What is the output for the A=10, B=0,C=a/b Dopl(C); ?

A. 0
B. 10
C. 1
D. Division by zero error
59. Which statement about triggers is true?

A. You use an application trigger to fire when a DELETE statement occurs.


B. You use a database trigger to fire when an INSERT statement occurs.
C. You use a system event trigger to fire when an UPDATE statement occurs.
D. You use INSTEAD OF trigger to fire when a SELECT statement occurs.
60. Debug the logic in a stored procedure. How do you monitor the value of variables in the procedure?

A. INSERT TEXT_IO.PUT_LINE statement to view data on the screen when the stored procedure is executed.
B. Insert break points in the code and observe the variable values displayed to the screen as the procedure is executed.
C. Insert DBMS_OUTPUT.PUT_LINE statement to view data on the screen when the stored procedure is executed.
D. Insert DEBUG VARIABLE statements to view the variable values on the screen as the procedure is executed.

You might also like