Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the NVL() function Create a SQL query that shows the customer address1, customer address 2, customer city, customer state and customer postal code from

Using the NVL() function

Create a SQL query that shows the customer address1, customer address 2, customer city, customer state and customer postal code from the CUSTOMERS table. Use the NVL() function to turn all NULL values for customer street address 2 to say ?First Floor?.

Using the NVL2() function

Modify the previous SQL query and add the customer email address. Use the NVL2() to return the string ?on file? if someone has an email address already. If someone doesn?t have an email address use the same NVL2() function to return an email address in the format first name?.?last name?@email.com?. Use to concatenation operator ?||? to form the email address.

Using the NULLIF() function

Create a SQL query that shows the product ID, product name and tags from the PRODUCTS_INFORMATION table. Use the NULLIF() function to turn the value returned to NULL if the tag ?Top seller? appears in the tags column.

Nesting NULL value functions

Modify the previous SQL query to nest the NULLIF() function inside of a regular NVL() function to show ?in stock? for the tags column if the value returned is NULL, which it should be since we used the NULLIF() function to turn all values for the column tags NULL.

Here are the two tables:

Customer Table  

image

Product Table

image

Column CUSTOMER_ID CUST_FIRST_NAME CUST_LAST_NAME STREET_ADDRESS POSTAL CODE CITY STATE_PROVINCE COUNTRY_ID PHONE_NUMBER NLS_LANGUAGE NLS TERRITORY CREDIT_LIMIT CUST_EMAIL Data Type NUMBER VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 CHAR VARCHAR2 VARCHAR2 VARCHAR2 NUMBER VARCHAR2 ACCOUNT_MGR_ID NUMBER Length Precision 22 20 20 40 10 30 10 2 25 3 30 22 30 22 6 9 6 Scale 0 2 0 Nullable No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes

Step by Step Solution

3.61 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

1 SQL query using NVL function to replace NULL values in customer address 2 sql SELECT customeraddre... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Programming questions

Question

What is a form?

Answered: 1 week ago