QUESTION 9
You plan to query data using the TRANS_HIST_V view that was created by another user in their schema. Which statement is true?
A. |
The Oracle Server will retrieve the view definition from the ALL_VIEWS data dictionary view. |
|
B. |
The Oracle Server will retrieve data, determined by the query criteria, from the TRANS_HIST_V view. |
|
C. |
The Oracle Server will verify whether you have been granted access privileges to the TRANS_HIST_V view. |
|
D. |
The Oracle Server will automatically reset the ARRAYSIZE value so the TRANS_HIST_V query will execute successfu |
QUESTION 10
The EMPLOYEE table contains these columns:
EMPLOYEE_ID NUMBER
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPT_ID NUMBER
JOB_ID VARCHAR2(15)
MGR_ID NUMBER
SALARY NUMBER(9,2)
COMMISSION NUMBER(7,2)
HIRE_DATE DATE
Which SELECT statement could be used to display the 10 lowest paid clerks that belong to department 70?
A. |
SELECT ROWNUM "Ranking", last_name||' ,'|| first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary FROM employee ORDER BY salary) WHERE ROWNUM <= 10 AND job_id LIKE 'CLERK‘ AND dept_id = 70; |
|
B. |
SELECT ROWNUM "Ranking", last_name||' ,'||first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary, job_id FROM employee WHERE job_id LIKE 'CLERK‘AND dept_id = 70 ORDER BY salary) WHERE ROWNUM <= 10; |
|
C. |
SELECT ROWNUM "Ranking", last_name||' ,'||first_name "Employee", salary "Salary" FROM (SELECT last_name, first_name, salary,job_id, dept_id FROM employee WHERE ROWNUM <= 10 ORDER BY salary) WHERE job_id LIKE 'CLERK‘ AND dept_id = 70; |
|
D. |
The desired result can only be achieved using a PL/SQL LOOP. |
QUESTION 11
The ACCOUNT table contains these columns:
ACCOUNT_ID NUMBER(12) NOT NULL, Primary Key
CREDIT_LIMIT NUMBER(7) NOT NULL
PREV_BALANCE NUMBER(7,2)
NEW_PURCHASES NUMBER(7,2)
PAYMENTS NUMBER(7,2)
FINANCE_CHARGE NUMBER(7,2)
You created a view definition based on the ACCOUNT table. This view allows users to insert and update records that can be queried using the view. Which statement did you use to create this view?
A. |
CREATE VIEW acct_hist_v AS SELECT account_id, prev_balance, new_purchases,payments FROM account; |
|
B. |
CREATE VIEW acct_credit_v AS SELECT DISTINCT credit_limit FROM account WHERE finance_charge > 75.00; |
|
C. |
CREATE VIEW delinq_accts_v AS SELECT * FROM account WHERE payments IS NULL AND finance_charge IS NOT NULL WITH CHECK OPTION; |
|
D. |
CREATE VIEW avg_finance_v AS SELECT account_id, AVG(finance_charge) "Avg F.Charge“ FROM account GROUP BY finance_charge WITH CHECK OPTION; |
QUESTION 12
Which type of view is implemented as a subquery embedded in the FROM clause of a SELECT statement and is identified by an alias?
A. |
Nested |
|
B. |
Simple |
|
C. |
inline |
|
D. |
complex |
QUESTION 13
Evaluate this view definition:
CREATE OR REPLACE VIEW order_hist_v AS
SELECT customer_id, COUNT(order_id) "Total Orders"
FROM order
WHERE order_amt >= 300
GROUP BY customer_id;
Which statement using the ORDER_HIST_V view will execute successfully?
A. |
SELECT * FROM order_hist_v; |
|
B. |
UPDATE order_hist_v SET emp_id = 389 WHERE emp_id = 5423 AND order_amt <= 50; |
|
C. |
DELETE FROM order_hist_v WHERE customer_id = 794; |
|
D. |
INSERT INTO order_hist_v (order_id, customer_id,emp_id, order_dt) VALUES (8456, 292, 104, '10-OCT-2001'); |
Q9
Ans: (c). The Oracle Server will verify whether you have been
granted access privileges to the TRANS_HIST_V view.
Explanation: Due to the security issues, first you should
have access to the TRANS_HIST_V view,=.
Q10
Ans: (b). SELECT ROWNUM "Ranking", last_name||' ,'||first_name
"Employee", salary "Salary"
FROM (SELECT last_name, first_name, salary, job_id
FROM employee
WHERE job_id LIKE 'CLERK‘AND dept_id = 70
ORDER BY salary)
WHERE ROWNUM <= 10;
Explanation: In a nested query, we are supposed to find employee last name, first name, salary, job_id whose joi id contains clerk and department id is 70 or order them according to salary
Q11
Ans: (C). CREATE VIEW delinq_accts_v AS
SELECT *
FROM account
WHERE payments IS NULL
AND finance_charge IS NOT NULL
WITH CHECK OPTION;
Explanation: Only option c satisfy the requirement
Q12
Ans: (c). inline
Explanation: the inline view is implemented as subquery
embedded in the from clause of a select statement
Q13
Ans: (a). SELECT * FROM order_hist_v;
Explanation: The reason being Order_hist_v view contains a
Group by clause. DML can't be performed through a view
QUESTION 9 You plan to query data using the TRANS_HIST_V view that was created by another...
Using the below Relational Design from Oracle SQL data modeler, provide sql script for the following queries (note please be sure to include "PART3.Table_name" when pulling info from specific tables) Query 6: How many orders are there by customer and what is the total sales and total profit sorted by customer’s total number of orders? Query 15: What is the total number of orders by shipping class? Query16: What are the monthly total sales from 2013 to 2014? Query 17:...
QUESTION 27 The SET command is used in which statement UPDATE SELECT DISTINCT DELETE FROM INSERT VALUES QUESTION 28 Which view would you use to see only the tables you have created ALL_TABLES USER_TABLES USER_TABS ALL_OBJECTS QUESTION 29 Which command should you use to write logical units of work to disk permanently SAVEWORK COMMIT ROLLBACK INSERT QUESTION 30 A Top-N Analysis is capable of ranking a top or bottom set of results. True False QUESTION 31 If you are performing...
Lesson 10Create the DEPARTMENT tables based on the following: Column Name ID Name Data Type Number Varchar2 Length 7 25 Populate the DEPARTMENT table with data from the DEPT table. Include only columns that you need. Create the EMPLOYEE table based on the following table chart: Column Name ID LAST_NAME FIRST_NAME DEPT_ID Data Type Number Varchar2 Varchar2 Number Length 7 25 25 7 Modify the EMPLOYEE table to allow for longer employee last names. Confirm your modification. Confirm that both the...
Write Ten SQL SELECT statements to query the STUDENT schema you created for practice lab. 4. List all cities that have 10 or more students and instructors combined. Show city, state, number of student residents, number of instructor residents, and total student/instructor residents in that city. Sort by total in descending order. 5. List the instructor id and name of the instructors that teach fewer than 10 sections. 7. Find how many students are enrolled in sections taught by Todd...
IN THE PREVIOUS CHAPTER WE MADE A DATABASE USING OUR LAST NAME AS ITS NAME. QUESTION 1 STATES THIS. PLEASE TYPE WHAT NEEDS TO BE TYPED FOR ALL STEPS. THIS USES CODIO a. 1. Connect to the database you created and named in Module One (for example, Jetson). Type after the prompt mysql> a. use (table you named); i. Example: mysql> use Jetson; 2. Create the Employee table using the SQL statement shown here. Press Return after each line. CREATE...
I am using oracle sql developer to create some queries to generated reports and it is not working. I am not sure how to use count, group by, and order by. Help me fix my query and explain to me how you did, so can do it next time. Also, I have to convert this query to a stored procedure, so can you help me do it too? Here is my query: SELECT COUNT(GUEST.FIRSTNAME), GUEST.FIRSTNAME, GUEST.LASTNAME, GUEST.GUESTTYPE, RESERVATION.RESERVATIONDATE, GUEST.EMAIL, FROM...
Please help me on the SQL queries, thank you so much. Write a query to display the title and publisher as well as the publisher contact for each book using JOIN...USING clause. Write a query to show the first and last names of customers who have ordered cooking books. Use the WHERE clause to join the tables. Write a query to show the title, cost and ISBN of each book in the books table. If the book has been ordered,...
Create a procedure to update the sales history table following the requirements below. A table creation script is provided below. a) Call the procedure: UPDATE_SALES_HISTORY (The procedure name is important for our scripts to test and grade your code; please do not rename it (otherwise our scripts will not run and your score will be 0). b) The procedure takes 2 parameters: (4-digit-year, 2-digit-month). Both parameters will be numeric, e.g., (2019, 11) will denote 2019 (year) and November (month). The...
Q2. Retrieve the names of all employees from the employee table to produce output on CSV format or delimited format with a common delimeter, rather than separete columns. Hint:Put the whole row into a string with a semicolon as the seperator(delimeter) between thecolumns: FORMAT:(fname;minit;lname) Example: EMPLOYEES -------------- James;E;Borg Frank;T;Wong Q3. Write a query to show the employees name from the employee table in this format: first letter of the first name, followed by a dot, a blank, and the full...
Question 32 Which view would you use to see only the tables you have created ALL_TABLES USER_TABLES USER_TABS ALL_OBJECTS 2 points Question 33 Which script will you execute to create new user DAVE and give him the ability to connect to the database and the ability to create tables, sequences, and procedures? CREATE USER dave IDENTIFIED BY dave18; GRANT create table, create sequence, create procedure TO dave; CREATE USER dave IDENTIFIED BY dave18; GRANT create session, create table, create sequence,...