1 / 10

PRACTICE 1

PRACTICE 1. Drilling DBA-SQL. 1. Exhibit: Which two statements are true regarding SQL statements that can be executed on the EMP_DETAIL table? (Choose two.) An EMP_IMAGE column can be included in the GROUP BY clause You cannot add a new column to the table with LONG as the data type

kohana
Download Presentation

PRACTICE 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PRACTICE 1 Drilling DBA-SQL

  2. 1. Exhibit: Which two statements are true regarding SQL statements that can be executed on the EMP_DETAIL table? (Choose two.) • An EMP_IMAGE column can be included in the GROUP BY clause • You cannot add a new column to the table with LONG as the data type • An EMP_IMAGE column cannot be included in the ORDER BY clause • You can alter the table to include the NOT NULL constraint on the EMP_IMAGE column

  3. 20. You want to create a SALE_PROD view by executing the following SQL statement: CREATE VIEW sale_prod AS SELECT p.prod_id, cust_id, SUM(quantity_sold) “Quantity”, SUM(prod_list_price) “Price” FROM product p, sales s WHERE p.prod_id = s.prod_id GROUP BY p.prod_id, cust_id Which statement is true regarding the execution of the above statement? • The view will be created and you can perform DML operations on the view • The view will be created but no DML operations will be allowed on the view • The view will not be created because the join statements are not allowed for creating a view • The view will not be created because the GROUP BY clause is not allowed for craeting a view

  4. 28. Exhibit the INVOICE table Which two SQL statements would executes successfully? (Choose two.) • SELECT MAX(inv_date), MIN(cust_id) FROM invoice; • SELECT MAX(AVG(SYSDATE – inv_date)) FROM invoice • SELECT (AVG(inv_date) FROM invoice; • SELECT AVG(inv_date – SYSDATE), AVG(inv_amt) FROM invoice;

  5. 29. You need to generate a report that shown the average credit limit for customers in WASHINTON and NEW YORK. Which SQL statement would produce the required result? • SELECT cust_city, AVG(NVL(cust_credit_limit, 0)) FROM customers GROUP BY cust_city WHERE cust_city IN (‘WASHINGTON’, ‘NEW YORK’); • SELECT cust_city, AVG(cust_credit_limit) FROM customers WHERE cust_city IN (‘WASHINGTON’, ‘NEW YORK’) GROUP BY cust_city, cust_credit_limit; • SELECT cust_city, AVG(cust_credit_limit) FROM customers WHERE cust_city IN (‘WASHINGTON’, ‘NEW YORK’) GROUP BY cust_city; • SELECT cust_city, AVG(cust_credit_limit) FROM customers WHERE cust_city IN (‘WASHINGTON’, ‘NEW YORK’) GROUP BY cust_credit_limit, cust_city;

  6. 30. Which statement would display the highest credit limit available in each income level in each city in the CUSTOMERS table? • SELECT cust_city, cust_income_level, MAX(cust_credit_limit) FROM customers GROUP BY cust_city, cust_income_level; • SELECT cust_city, cust_income_level, MAX(cust_credit_limit) FROM customers GROUP BY cust_credit_limit, cust_income_level, cust_city; • SELECT cust_city, cust_income_level, MAX(cust_credit_limit) FROM customers GROUP BY cust_city, cust_income_level, cust_credit_limit; • SELECT cust_city, cust_income_level, MAX(cust_credit_limit) FROM customers GROUP BY cust_city, cust_income_level, MAX(cust_credit_limit) ;

  7. 31. Evaluate the following SQL statement: SQL>SELECT promo_category, AVG(promo_cost) Avg_Cost, AVG(promo_cost) * .25 Avg_Overhead FROM promotions WHERE UPPER(promo_category) IN (‘TV’, ‘INTERNET’, ‘POST’) GROUP BY Avg_Cost ORDER BY Avg_Overhead; The above query generates an error on execution. Which clause in the above SQL statement causes the error • WHERE • SELECT • GROUP BY • ORDER BY

  8. STUDENT FACULTY 35. You need to display the faculty name followed by the number of students handled by the faculty at the base location. Examine the following two SQL statements: Statement 1: SQL>SELCT faculty_name, COUNT(student_id) FROM student JOIN faculty USING (faculty_id, location_id) GROUP BY faculty_name; Statement2: SQL>SELECT faculty_name, COUNT(student_id) FROM student NATURAL JOIN faculty GROUP BY faculty_name; Which statement is tru regarding the outcome? • Only statement 1 executes successfully and gives the required result • Only statement 2 executes successfully and gives the required result • Both statement 1 eand 2 xecutes successfully and give the different result • Both statement 1 and 2 executes successfully and give the same required result

  9. 41. Which two statements are true regarding the COUNT function? (Choose two.) • The COUNT function can be used only for CHAR, VARCHAR2, and NUMBER data types • COUNT(*) returns the number of rows including duplicate rows and rows containing NULL value in any of the columns • COUNT(cust_id) retruns the number of rows including rows with duplicate customer IDs and NULL value in the CUST_ID column • COUNT(DISTINCT inv_amt) retruns the number of rows excluding rows containing duplicates and NULL value in the INV_AMT column • A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause

  10. 47. Which three statements are true regarding subqueries? (Choose three.) • Multiple columns or expressions can be compared between the main query and subquery • Main query and subquery can get data from different tables • Subqueries can contain GROUP BY and ORDER BY clause • Main query and subquery must get data from the same tables • Subqueries can contain ORDER BY but not the GROUP BY clause • Only one column or expression can be compared between the main query and subquery

More Related