Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

The expression salary department equivalent salary department

112 Chapter 3: Restricting and Sorting Data

column has a data type of NUMBER(8,2). Figure 3-1 shows two different ways in which the SALARY column has been restricted. The first and second examples retrieve the LAST_NAME and SALARY values of the employees who earn $10,000. Notice the difference in the WHERE clauses of the following queries. The first query specifies the number 10000, while the second encloses the number within single quotes like a character literal. Both formats are acceptable to Oracle since an implicit data type conversion is performed when necessary.

FIGURE 3-1

Two ways to
select numeric values in a
WHERE clause

The second example in Figure 3-2 demonstrates extending the WHERE clause condition to compare a numeric column, SALARY, to the numeric expression: DEPARTMENT_ID*100. For each row, the value in the SALARY column is compared to the product of the DEPARTMENT_ID value and 100. The WHERE clause also permits expressions on either side of the comparison operator. You could issue the following statement to yield identical results:

SELECT last_name, salary
FROM employees
WHERE salary/10 = department_id*10;

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELI79011FE
img
Uploaded by :
9WpL9g9y
Page 1 Preview
the expression salary department equivalent salary
Sell Your Old Documents & Earn Wallet Balance