205k views
2 votes
Consider the database table structure shown in the figure. (a) Write a SELECT statement statement (compatible with an Oracle RDBMS) that returns one column from the vendors table named full_name. Create this result column from the vendor_contact_first_name and vendor_contact_last_name columns, and format it like this: last name – comma – space - first name (for example, "Doe, John"). Next, add code words to this statement so that the result set would be sorted by last name and then first name. In addition, add code words so that the result set is filtered for contacts whose last name begins with the letter A or E. (b) Then write two rows of sample data that might be retrieved by the query. What is actually retrieved depends on what is in the table. The data you write does not have to match any data that is actually in our sample tables

1 Answer

6 votes

Answer:

The table is attached as a picture.

a)

Select VENDOR_CONTACT_LAST_NAME || ', ' || VENDOR_CONTACT_FIRST_NAME "full_name" from VENDORS where VENDOR_CONTACT_LAST_NAME like 'A%' or VENDOR_CONTACT_LAST_NAME like 'E%' order by VENDOR_CONTACT_LAST_NAME,VENDOR_CONTACT_FIRST_NAME;

concatenation operator || is used . Also LIKE is used for pattern matching. full_name is alias for the concatenated column

b) As sample data is not given ,Please test the query for the data given in table

Step-by-step explanation:

Consider the database table structure shown in the figure. (a) Write a SELECT statement-example-1
User Sergiy Lichenko
by
6.0k points