Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please give me all 25 question answer as soon as possible. You need to use your

ID: 3852119 • Letter: P

Question

 
please give me all 25 question answer as soon as possible.
You need to  use your owned SQL knowledge to verify all multiple question answers and hand-on exercise questions. Enjoy leaning SQL in Oracle!

[Part One / Multiple Questions]

1. Evaluate this SQL statement:

SELECT manufacturer_id, COUNT(*), order_date

 FROM inventory

WHERE price > 5.00

GROUP BY order_date, manufactured_id

HAVING COUNT(*) > 10

ORDER BY order_date DESC;

Which clause specifies which rows will be returned from the inventory table (choose only one answer below)?

WHERE price > 5.00

HAVING COUNT(*) > 10

ORDER BY order_date DESC;

GROUP BY order_date, manufactured_id

Answer:

2. For which result would you use a group function (choose only one answer below)?

To display the order date of orders in ‘DD MON YYYY’ format

To convert the character string ‘January 28, 2000’ to a date format

To produce a total of all the values in the COST column in the PRODUCT table

To display all the values in the DESCRIPTION column in the PRODUCT table in lowercase

Answer:

3. For which task can you use the TO_CHAR function (choose only one answer below)?

to accept 'October 20, 1965' and store it as a date value  

to accept 'ten' and store it as a number 10

to accept the number 10 and store it as 'ten'

to display a date value in 'MM/DD/YY' format

Answer:

   

    

Which character function can you use to return a specified portion of a character string (choose only one answer below)?

INITCAP

CONCAT  

SUBSTR  

LENGTH

Answer:

Benefits are based on the number of years an employee has been employed. You need to create a report to display each employee’s name, id number, date hired, and the number of years employed, rounded to a whole number, based on the number of months from the date hired until today. Which statement produces the required results (choose only one answer below)?

Select first_name, last_name, emp_id, date_hired, ROUND(SYSDATE) – ROUND(date_hired)

FROM employee;

Select first_name, last_name, emp_id, date_hired,

(ROUND(SYSDATE) – ROUND(date_hired))/12

FROM employee;

Select first_name, last_name, emp_id, date_hired,

TRUNC(SYSDATE, ‘YY’) – TRUNC(date_hired, ‘YY’)

FROM employee;

Select first_name, last_name, emp_id, date_hired,

ROUND(MONTHS_BETWEEN(SYSDATE, date_hired)/12) FROM employee;

Answer:

The primary advantage of using JOIN ON is (choose only one answer below):

The join happens automatically based on matching column names and data types

It will display rows that do not meet the join condition

It easily produces a Cartesian product between the tables in the statement

It permits columns with different names to be joined

Answer:

Based on the INVENTORY instance chart in the following:

You attempt to query the database with this SQL statement:

SELECT  NVL(100/quantity, none)  

 FROM   inventory;

Why does this statement cause an error when quantity values are null (choose only one answer below)?

The expression attempts to divide by a null value.

The data types in the conversion function are incompatible.

The character string none should be enclosed in single quotes (‘’).

A null value used in an expression cannot be converted to an actual value.

Answer:

On which side of the outer join condition would you place the outer join symbol (choose only one answer below)?

the side with matching rows

the side without matching rows

both sides of the join condition

neither side of the join condition

Answer:

Evaluate this SQL statement:

SELECT  i.id_number, m.manufacturer_id

 FROM  inventory i, inventory m

WHERE  i.manufacturer_id = m.id_number;

What type of join is used in this statement (choose only one answer below)?

self  

outer

equijoin

non-equijoin

Answer:

A NATURAL JOIN is based on (choose only one answer below):

Columns with the same data type and width  

Columns with the same name

Columns with the same name and data type  

Tables with the same structure

Answer:

What happens when you create a Cartesian product (choose only one answer below)?

All rows from one table are joined to all rows of another table  

No rows are returned as you entered wrong join-criteria

The table is joined to itself, one column to the next column, exhausting all   possibilities  

All rows that do not match in the WHERE clause are displayed

Answer:

Assuming an EMPLOYEE table has columns of Emp_Id, L_Name, F_Name, M_Name and Salary.   Please write a statement to display those employees who have no middle names (i.e. M_NAME).

Answer:

Which Select statement could you use if you wanted to display unique combinations of the ID_NUMBER and MANUFACTURER_ID values from the INVENTORY table (choose only one answer below)?

SELECT  DISTINCT manufacturer_id

    FROM  inventory;

SELECT  id_number, manufacturer_id

    FROM  inventory;

SELECT  DISTINCT id_number, manufacturer_id

    FROM  inventory;

SELECT  id_number, manufacturer_id DISTINCT

    FROM  inventory;

SELECT  id_number, DISTINCT manufacturer_id

    FROM  inventory;

Answer:

The ITEM table contains these columns:

COST NUBMER(7,2)  RETAIL NUMBER(7,2)

The RETAIL and COST columns must have a value that is greater than zero. Evaluate these two SQL    

Statements:

1.  SELECT

retail – cost * 1.25 * .10

   FROM

item;

2.  SELECT

(retail – (cost *1.25 )*.10)

   FROM

item;

What will be the results (choose only one answer below)?

Statement 1 will return a low value than statement 2.

Statement 1 and statement 2 will return the same values.  

Statement 1 will return a higher value than statement 2.  

Only one of the statements will execute.

Answer:

Based on the INVENTORY table displayed as follows:

Evaluate this SQL statement (NOTE: This is a tricky question):

SELECT  id_number

 FROM  inventory

WHERE  description = 'cable'

Which value would be displayed (choose only one answer below)?

 

25023

25025  

25027  

25028

No value will be displayed.

Answer:

For which task would you use the WHERE clauses in a SELECT statement (choose only one answer below)?

to designate the INVENTORY table location

to compare the MANUFACTURED_ID values to 897898  

to display only the unique MANUFACTURE_ID values  

to restrict the output of the SUM(price) function  Answer:

 

Which operator would it be most appropriate to use when searching on a list of values (choose only one answer below)?

=

IN

LIKE

BETWEEN … AND …

Answer:

Based on the INVENTORY table in question 15, evaluate this SQL statement:

    SELECT     MIN(description) FROM inventory;

Which value is displayed (choose only one answer below)?

Cable

Ribbon

Copper Wire

Vinyl Sheets  

Answer:

Based on the INVENTORY table in question 15, evaluate this SQL statement:

SELECT manufacturer_id “Manufacturer Identification Number”, SUM(price)

 FROM inventory

WHERE price > 6.00

GROUP BY “Manufacturer Identification Number”

ORDER BY 2;

 Which clause will cause an error (choose only one answer below)?

ORDER BY 2;

FROM inventory

WHERE price > 6.00

GROUP BY “Manufacturer Identification Number”

SELECT manufacturer_id “Manufacturer Identification Number”, SUM(price)  Answer:

Which clause could you use to restrict values returned by a group function (choose only one answer below)?

WHERE  

HAVING  

ORDER

A group function cannot be restricted  

Answer:

Which operator would it be most appropriate to use with a single row subquery (choose only one answer below)?

=

IN

LIKE

BETWEEN … AND…  

Answer:

If you need to display data from two tables that have common values existing in corresponding columns, which type of join condition would you use (choose only one answer below)?

self  

outer

equijoin

non-equijoin

Answer:

Based on the instance chart in Question 7.  You created a report to display the prices of products from your warehouse inventory.  Which script will you use to display the prices in this format:

“$0.25” (choose only one answer below)?

   

SELECTFROM         TO_CHAR(price,inventory;     ‘$9.99’)

SELECT     TO_CHAR(price, ‘$999990’)

         FROM     inventory;

SELECT     TO_NUM(price, ‘$999990.99’)

FROMSELECT         inventory;TO_NUM(price,  ‘$999990.99’)

         FROM     inventory;

SELECT     TO_CHAR(price, ‘$999990.99’)

        FROM     inventory;

Answer:

You attempt to query the database with this SQL statement:

SELECT  inventory.id_number, manufactuer.id_number         FROM  inventory i, manufacturer m

 WHERE  i.manufacturer_id = m.id_number

  ORDER BY 1;

Which line will cause an error (choose only one answer below)?

ORDER BY 1;

FROM inventory I, manufacturer m

WHERE i.manufacturer_id = m.id_number

SELECT inventory.id_number, manufactuer.id_number

Answer:

Based on the Question 15. You query the database and return the value 0804.  Which script did

you use (choose only one answer below)?

SELECT SUB(manufacturer_id, 4)  

  FROM inventory    WHERE id_number = 32081;

SELECT SUBSTR(manufacturer_id, 4)

  FROM inventory

 WHERE id_number = 32081;

SELECT SUBSTR(manufacturer_id, -4, 4)

  FROM inventory

 WHERE id_number = 32081;

SELECT SUBSTR(manufacturer_id, 4, -4)  

  FROM inventory

 WHERE id_number = 32081;

None of the scripts returns a value of 0804.  

Answer:  

Explanation / Answer

Posting too many question in one thread, is probably not a good idea. You should try to break it and then submit it. I can't answer all the 25 questions. However, I will answer the first five. Here goes:

1. Answer: WHERE price > 5.00
The where clause selects what is to be obtained from the table. There can be confusion between having clause and where clause, but having clause works on group by and let's us know what to be displayed once grouped. order by and group by just order the rows and group according to the condition respectively.

2. Answer: To produce a total of all the values in the COST column in the PRODUCT table
Group by function works with aggregate function i.e. SUM, COUNT, MIN and all that and to get the total (summing) we have to use group by clause.

3. Answer: to display a date value in 'MM/DD/YY' format
TO_CHAR function uses format_mask to set how the output should look like. For example: You can use format like TO_CHAR(sysdate, 'yyyy/mm/dd') to display in year/month/date format or use the above format as parameter to display it in that format.

4. Answer: SUBSTR
INITCAP just returns the first letter of each word in capitals, CONCAT just concatenates and LENGTH returns the length. However, SUBSTR returns the part of the string specified in it's parameters.

5. Answer: Select first_name, last_name, emp_id, date_hired, ROUND(MONTHS_BETWEEN(SYSDATE, date_hired)/12) FROM employee;
The above query just counts the months between today and hiring date and then divides it by 12 to get the years. Also, we want rounded result so we used ROUND function. All other queries are not appropriate method of extracting the year.