GoConqr has a new look! Let us know what you think.

Quiz

DBA 191

Carla Hales 191 questions 5.0 (3 ratings) Updated 3 Feb 2018

Take the quiz

This quiz has a time limit, so it opens in the usual player.

Questions in this quiz (191)

  1. 1Examine the structure of the PROMOTIONS table.
    Each promotion has a duration of at least seven days. Your manager has asked you to generate a report, which provides the weekly cost for each promotion done to date.
    Which query would achieve the required result?
    Image for question 1
    1. ASELECT promo_name, promo_cost/promo_end_date-promo_begin_date/7 FROM promotions;
    2. BSELECT promo_name,(promo_cost/promo_end_date-promo_begin_date)/7 FROM promotions;
    3. CSELECT promo_name, promo_cost/(promo_end_date-promo_begin_date/7) FROM promotions;
    4. DSELECT promo_name, promo_cost/((promo_end_date-promo_begin_date)/7) FROM promotions;
  2. 2View the Exhibit and examine the description for the PRODUCTS and SALES table. PROD_ID is a primary key in the PRODUCTS table and foreign key in the SALES table. You want to remove all the rows from the PRODUCTS table for which no sale was done for the last three years. Which is the valid DELETE statement?Image for question 2
    1. ADELETE
      FROM products
      WHERE prod_id = (SELECT prod_id
      FROM sales
      WHERE time_id – 3*365 = SYSDATE );
    2. BDELETE
      FROM products
      WHERE prod_id = (SELECT prod_id
      FROM sales
      WHERE SYSDATE >= time_id– 3*365);
    3. CDELETE
      FROM products
      WHERE prod_id IN (SELECT prod_id
      FROM sales
      WHERE SYSDATE–3*365 >= time_id);
    4. DDELETE
      FROM products
      WHERE prod_id IN (SELECT prod_id
      FROM sales
      WHERE time_id >= SYSDATE–3*365);
  3. 3View the Exhibit and examine the description of SALES and PROMOTIONS tables.
    You want to delete rows from the SALES table, where the PROMO_NAME column in the PROMOTIONS table has either blowout sale or everyday low price as values.
    Which DELETE statements are valid? (Choose all that apply.)
    Image for question 3
    1. ADELETE
      FROM sales
      WHERE promo_id = (SELECT promo_id
      FROM promotions
      WHERE promo_name = ‘blowout sale’)
      AND promo_id = (SELECT promo_id
      FROM promotions
      WHERE promo_name = ‘everyday low price’);
    2. BDELETE
      FROM sales
      WHERE promo_id = (SELECT promo_id
      FROM promotions
      WHERE promo_name = ‘blowout sale’)
      OR promo_id = (SELECT promo_id
      FROM promotions
      WHERE promo_name = ‘everyday low price’);
    3. CDELETE
      FROM sales
      WHERE promo_id IN (SELECT promo_id
      FROM promotions
      WHERE promo_name = ‘blowout sale’
      OR promo_name = ‘everyday low price’);
    4. DDELETE
      FROM sales
      WHERE promo_id IN (SELECT promo_id
      FROM promotions
      WHERE promo_name IN (‘blowout sale’,’everyday low price’));
  4. 4View the Exhibit and examine the description for the CUSTOMERS table.
    You want to update the CUST_INCOME_LEVEL and CUST_CREDIT_LIMIT columns for the customer with the CUST_ID 2360. You want the value for the CUST_INCOME_LEVEL to have the same value as that of the customer with the CUST_ID 2560 and the CUST_CREDIT_LIMIT to have the same value as that of the customer with CUST_ID 2566.
    Which UPDATE statement will accomplish the task?
    Image for question 4
    1. AUPDATE customers
      SET cust_income_level = (SELECT cust_income_level
      FROM customers
      WHERE cust_id = 2560),
      cust_credit_limit = (SELECT cust_credit_limit
      FROM customers
      WHERE cust_id = 2566)
      WHERE cust_id=2360;
    2. BUPDATE customers
      SET (cust_income_level,cust_credit_limit) = (SELECT
      cust_income_level, cust_credit_limit
      FROM customers
      WHERE cust_id=2560 OR cust_id=2566)
      WHERE cust_id=2360;
    3. CUPDATE customers
      SET (cust_income_level,cust_credit_limit) = (SELECT
      cust_income_level, cust_credit_limit
      FROM customers
      WHERE cust_id IN(2560, 2566)
      WHERE cust_id=2360;
    4. DUPDATE customers
      SET (cust_income_level,cust_credit_limit) = (SELECT
      cust_income_level, cust_credit_limit
      FROM customers
      WHERE cust_id=2560 AND cust_id=2566)
      WHERE cust_id=2360;
  5. 5View the Exhibit and examine the structure of CUSTOMERS and SALES tables.

    Evaluate the following SQL statement:
    UPDATE (SELECT prod_id, cust_id, quantity_sold, time_id
    FROM sales)
    SET time_id = ’22-MAR-2007′
    WHERE cust_id = (SELECT cust_id
    FROM customers
    WHERE cust_last_name = ‘Roberts’ AND credit_limit = 600);
    Which statement is true regarding the execution of the above UPDATE statement?
    1. AIt would not execute because two tables cannot be used in a single UPDATE statement.
    2. BIt would not execute because the SELECT statement cannot be used in place of the table name.
    3. CIt would execute and restrict modifications to only the columns specified in the SELECT statement.
    4. DIt would not execute because a subquery cannot be used in the WHERE clause of an UPDATE statement.
  6. 6View the Exhibit and examine the description for the CUSTOMERS table.
    You want to update the CUST_CREDIT_LIMIT column to NULL for all the customers, where CUST_INCOME_LEVEL has NULL in the CUSTOMERS table.
    Which SQL statement will accomplish the task?
    Image for question 6
    1. AUPDATE customers
      SET cust_credit_limit = NULL
      WHERE CUST_INCOME_LEVEL = NULL;
    2. BUPDATE customers
      SET cust_credit_limit = NULL
      WHERE cust_income_level IS NULL;
    3. CUPDATE customers
      SET cust_credit_limit = TO_NUMBER(NULL)
      WHERE cust_income_level = TO_NUMBER(NULL);
    4. DUPDATE customers
      SET cust_credit_limit = TO_NUMBER(‘ ‘,9999)
      WHERE cust_income_level IS NULL;
  7. 7View the exhibit and examine the description for the SALES and CHANNELS tables.

    You issued the following SQL statement to insert a row in the SALES table:

    INSERT INTO sales VALUES
    (23, 2300, SYSDATE, (SELECT channel_id
    FROM channels
    WHERE channel_desc=’Direct Sales’), 12, 1, 500);
    Which statement is true regarding the execution of the above statement?
    Image for question 7
    1. AThe statement will execute and the new row will be inserted in the SALES table.
    2. BThe statement will fail because subquery cannot be used in the VALUES clause.
    3. CThe statement will fail because the VALUES clause is not required with subquery.
    4. DThe statement will fail because subquery in the VALUES clause is not enclosed with in single quotation marks.
  8. 8View the Exhibit and examine the structure of ORDERS and CUSTOMERS tables.

    There is only one customer with the cust_last_name column having value Roberts.
    Which INSERT statement should be used to add a row into the ORDERS table for the customer whose
    CUST_LAST_NAME is Roberts and CREDIT_LIMIT is 600?
    Image for question 8
    1. AINSERT INTO orders
      VALUES (1,’10-mar-2007′, ‘direct’,
      (SELECT customer_id
      FROM customers
      WHERE cust_last_name=’Roberts’ AND credit_limit=600), 1000);
    2. BINSERT INTO orders (order_id,order_date,order_mode,
      (SELECT customer_id
      FROM customers
      WHERE cust_last_name=’Roberts’ AND credit_limit=600),order_total)
      VALUES(1,’10-mar-2007′, ‘direct’, &&customer_id, 1000);
    3. CINSERT INTO(SELECT o.order_id, o.order_date,o.order_mode,c.customer_id, o.order_total
      FROM orders o, customers c
      WHERE o.customer_id = c.customer_id
      AND c.cust_last_name=’Roberts’ ANDc.credit_limit=600 )
      VALUES (1,’10-mar-2007′, ‘direct’,(SELECT customer_id
      FROM customers
      WHERE cust_last_name=’Roberts’ AND credit_limit=600), 1000);
    4. DINSERT INTO orders (order_id,order_date,order_mode,
      (SELECT customer_id
      FROM customers
      WHERE cust_last_name=’Roberts’ AND credit_limit=600),order_total)
      VALUES(1,’10-mar-2007′, ‘direct’, &customer_id, 1000);
  9. 9View the Exhibit and examine the structure of the CUSTOMERS table.

    NEW_CUSTOMERS is a new table with the columns CUST_ID, CUST_NAME and CUST_CITY that have the same data types and size as the corresponding columns in the CUSTOMERS table.
    Evaluate the following INSERT statement:

    INSERT INTO new_customers (cust_id, cust_name, cust_city)
    VALUES(SELECT cust_id,cust_first_name’ ‘cust_last_name,cust_city
    FROM customers
    WHERE cust_id > 23004);

    The INSERT statement fails when executed.
    What could be the reason?
    Image for question 9
    1. AThe VALUES clause cannot be used in an INSERT with a subquery.
    2. BColumn names in the NEW_CUSTOMERS and CUSTOMERS tables do not match.
    3. CThe WHERE clause cannot be used in a subquery embedded in an INSERT statement.
    4. DThe total number of columns in the NEW_CUSTOMERS table does not match the total number of columns in the CUSTOMERS table.
  10. 10View the Exhibit and examine the structure of the PRODUCTS tables.

    You want to generate a report that displays the average list price of product categories where the average list price is less than half the maximum in each category.
    Which query would give the correct output?
    Image for question 10
    1. ASELECT prod_category,avg(prod_list_price)
      FROM products
      GROUP BY prod_category
      HAVING avg(prod_list_price) < ALL
      (SELECT max(prod_list_price)/2
      FROM products
      GROUP BY prod_category);
    2. BSELECT prod_category,avg(prod_list_price)
      FROM products
      GROUP BY prod_category
      HAVING avg(prod_list_price) > ANY
      (SELECT max(prod_list_price)/2
      FROM products
      GROUP BY prod_category);
    3. CSELECT prod_category,avg(prod_list_price)
      FROM products
      HAVING avg(prod_list_price) < ALL
      (SELECT max(prod_list_price)/2
      FROM products
      GROUP BY prod_category);
    4. DSELECT prod_category,avg(prod_list_price)
      FROM products
      GROUP BY prod_category
      HAVING avg(prod_list_price) > ANY
      (SELECT max(prod_list_price)/2
      FROM products);

Information

Description
191 DBA Quiz on DBA 191, created by Carla Hales on 15/06/2016.
Language
English
Views
59
History
Created on 15 Jun 2016 · updated on 3 Feb 2018
Tags
dba191
Rating
5.0 out of 5 · 3 ratings
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?