Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TEN questions about database Question 39 1. All of the following are set operations that can be performed on suitable relational tables EXCEPT A. SUM

TEN questions about database

Question 39

1. All of the following are set operations that can be performed on suitable relational tables EXCEPT

A.

SUM

B.

INTERSECTION

C.

DIFFERENCE

D.

UNION

0.5 points

Question 40

1. Evaluate the SELECT statements in the following SQL compound queries:

SELECT emp_id

FROM emp

INTERSECT

SELECT emp_id FROM emp_hist;

SELECT emp_id FROM emp_hist INTERSECT SELECT emp_id FROM emp;

Which statement is TRUE regarding these SQL compound queries?

The results of the compound queries will be identical.

The first compound query will return more results than the second.

The second compound query will return more results than the first.

The second compound query will return a syntax error.

Question 42

1.

Which data type is an external large object (LOB) data type?

a.

CLOB

b.

BLOB

c.

LONG

d.

NCLOB

e.

BFILE

Question 44

1. In converting from an E-R diagram to a relational model, tables are used to represent

A.

only entities and attributes

B.

both entities and relationships

C.

relationships only

D.

entities only

0.5 points

Question 45

1.

You have created the following function:

CREATE OR REPLACE FUNCTION get_salary

(v_employee_id NUMBER)

RETURN NUMBER

IS

v_salary NUMBER;

BEGIN

SELECT salary

INTO v_salary

FROM employees

WHERE employee_id = v_emp_id;

RETURN v_salary;

END get_salary;

Which two statements will successfully invoke the get_salary function from the SQL*Plus environment?

(Choose two.)

a.

get_salary(205);

b.

EXECUTE get_salary(200);

c.

SELECT get_salary(150) from emp;

d.

SELECT get_salary(205) from dual;

e.

UPDATE emp SET SALARY = get_salary(200) WHERE employee_id = 250;

Question 48

1.

Examine this procedure:

CREATE OR REPLACE PROCEDURE find_cpt

(v_movie_id {argument mode} NUMBER, v_cost_per_ticket {argument mode} NUMBER)

IS

BEGIN

IF v_cost_per_ticket > 9.50 THEN

SELECT cost_per_ticket

INTO v_cost_per_ticket

FROM gross_receipt

WHERE movie_id = v_movie_id;

END IF;

END;

Which argument mode should be used for v_movie_id ?

a.

IN

b.

OUT

c.

IN OUT

d.

IN RETURN

Question 51

1.

Examine this function:

CREATE OR REPLACE FUNCTION set_budget

(v_studio_id IN NUMBER, v_new_budget IN NUMBER)

RETURN NUMBER

IS

BEGIN

UPDATE studio

SET yearly_budget = v_new_budget

WHERE id = v_studio_id;

COMMIT;

RETURN SQL%ROWCOUNT;

END;

While executing this in SQL*Plus, you want to see the value of SQL%ROWCOUNT displayed on the screen.

Which line of code will accomplish this?

a.

OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

b.

DBMS_DEBUG.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

c.

DBMS_OUTPUT.DISPLAY(TO_CHAR(SQL%ROWCOUNT));

d.

DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT));

Question 55

1. Code example 5-1 SELECT vendor_state, vendor_city, vendor_name, COUNT(*) AS invoice_qty, SUM(invoice_total) AS invoice_average FROM invoices JOIN vendors ON invoices.vendor_id = vendors.vendor_id WHERE vendor_state < 'e' GROUP BY vendor_state, vendor_city, vendor_name HAVING SUM(invoice_total) > 500 ORDER BY vendor_state, vendor_city, vendor_name

(Please refer to code example 5-1.) When this summary query is executed, the result set will contain one summary row for

a.

each city with invoice totals over $500

b.

each vendor with invoice totals over $500

c.

each vendor with invoice average over $500

d.

each city with invoice average over $500

Question 58

1. The ACCOUNT table contains these columns:

ACCOUNT_ID NUMBER(12) NEW_BALANCE NUMBER(7,2) PREV_BALANCE NUMBER(7,2) FINANCE_CHARGE NUMBER(7,2)

You must create statements to be mailed to all account holders. Each customer's statement must include the account holder's previous balance and finance charge in this format:

Previous Balance: 5000 Finance Charge: 45

Which SELECT statement will produce these results?

SELECT Previous Balance: ||prev_balance|| Finance Charge: ||prev_balance * .009 FROM account;

SELECT 'Previous Balance:' ||prev_balance|| 'Finance Charge:' ||prev_balance * .009 FROM account;

SELECT 'Previous Balance: '||prev_balance||' Finance Charge: '||prev_balance * .009 FROM account;

SELECT "Previous Balance: "||prev_balance||" Finance Charge: "||prev_balance * .009 FROM account;

Question 60

1.

Examine the following code:

CREATE OR REPLACE PACKAGE BODY update_emp

AS

FUNCTION show_sal(emp_id)

RETURN NUMBER

IS

v_salary NUMBER;

inc_sal NUMBER;

BEGIN

SELECT salary INTO v_salary FROM emp

WHERE employee_id = emp_id;

RETURN (v_salary);

END show_sal;

BEGIN

inc_sal := 5000;

END update_emp;

In the given code, when will the inc_sal variable be initialized?

a.

every time the update_emp package is invoked in a session

b.

when the package body of the update_emp package is compiled

c.

when the update_emp package is invoked for the first time in a session

d.

every time you invoke the show_sal function contained in the update_emp package

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago