Using Conversation Functions Flashcards
5 cards from real 1Z0-071 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 5 Using Conversation Functions flashcards as text
Which two are SQL features?
Answer: providing database transaction control
SQL (Structured Query Language) provides robust capabilities for managing database transactions, allowing users to commit or roll back changes to maintain data integrity. Additionally, SQL is designed to process sets of data, meaning it operates on entire groups of rows rather than individual records, which makes it highly efficient for database operations. These are core features distinguishing SQL from other programming languages.
Which two queries return rows for employees whose manager works in a different department?
Answer: SELECT emp. * FROM employees emp RIGHT JOIN employees mgr ON emp.manager_ id = mgr. employee id AND emp. department id <> mgr.department_ id WHERE emp. employee_ id IS NOT NULL;
Both queries D and E correctly identify employees whose manager works in a different department. Query E uses an `INNER JOIN` on `manager_id = employee_id` and then filters for `emp.department_id <> mgr.department_id`, directly selecting matching pairs where departments differ. Query D uses a `RIGHT JOIN` and then filters `emp.employee_id IS NOT NULL` to ensure we're looking at actual employees, while also applying the department ID mismatch condition in the join, effectively achieving the same result by focusing on employees whose manager is found and is in a different department.
Which statement executes successfully?
Answer: SELECT TO_CHAR(INTERVAL '800' SECOND, 'HH24:MM') FROM DUAL;
The `TO_CHAR` function is used to convert a value of a different data type (like `INTERVAL`, `DATE`, or `NUMBER`) into a character string. In this statement, `INTERVAL '800' SECOND` creates an interval value, and `TO_CHAR` can correctly format this interval into a string representation like 'HH24:MM' (hours and minutes). Other options attempt invalid conversions between `INTERVAL`, `DATE`, and `NUMBER` types directly.
Which SQL function can be used to convert a string to a number?
Answer: TO_NUMBER
The `TO_NUMBER` function in SQL is specifically designed to convert a character string into a numeric data type. This is essential when you have numbers stored as text and need to perform mathematical operations or comparisons on them. It allows for explicit type conversion, often with an optional format model.
What is the purpose of the TO_CHAR function in SQL?
Answer: To convert a number or date to a string.
The `TO_CHAR` function in SQL is primarily used to convert non-character data types, such as numbers or dates, into a character string. This is particularly useful for formatting output, allowing you to specify how dates or numbers should appear in a human-readable format. It enables flexible presentation of data from various types.