105k views
1 vote
Display the employee’s id, and then the first and last names in lower case. Use a substitution variable to allow a search at runtime by the employee’s last name. Use a function to be sure that whatever is entered at runtime is in the proper case. Search for an employee named Seo and show me the results.

Language should be in Oracle SQL.

1 Answer

3 votes

Final answer:

In Oracle SQL, to display the required employee information and search by last name using a substitution variable, use the LOWER function to transform the names and INITCAP for proper case handling in the WHERE clause of the SELECT statement.

Step-by-step explanation:

To display an employee's id, along with their first and last names in lower case, and to allow for a search using a substitution variable at runtime, you would use a SQL query in an Oracle SQL environment. The INITCAP function can be included to ensure that the user's input is in the proper case for the search. Below is an example query depicting this:SELECT employee_id, LOWER(first_name), LOWER(last_name)FROM employeesWHERE INITCAP(last_name) = '&employee_last_name';You would replace '&employee_last_name' with the actual last name of the employee you are searching for at runtime. Assuming the employee you are looking for is named 'Seo', the run time query would look like:SELECT employee_id, LOWER(first_name), LOWER(last_name)FROM employeesWHERE INITCAP(last_name) = 'Seo';Make sure that the substitution variable is inputted with the correct case so the query can operate correctly.

To display the employee's ID and first and last names in lowercase, you can use the LOWER function in Oracle SQL. To allow a search at runtime by the employee's last name, you can use a substitution variable. Here's an example query:SELECT employee_id, LOWER(first_name) AS first_name, LOWER(last_name) AS last_name FROM employees WHERE last_name = '&last_name';In this query, the substitution variable '&last_name' is used to prompt the user to enter the last name at runtime. The LOWER function is applied to both the first_name and last_name columns to convert them to lowercase. This ensures that whatever is entered at runtime is compared in the proper case.

User Kamika
by
9.2k points