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

Quiz

SQL Fundamentals

Erick Navarro 15 questions

Take the quiz

Questions in this quiz (15)

  1. 1View the Exhibit and examine the structure of the customers table.
    Using the customers table, you need to generate a report that shows an increase in the credit limit by 15% for all customers. Customers whose credit limit has not been entered should have the message "Not Available" displayed.
    Which SQL statement would produce the required result?
    Image for question 1
    1. ASELECT NVL(cust_credit_limit, 'Not Available')*0.15 "NEW CREDIT"
      FROM customers;
    2. BSELECT NVL(cust_credit_limit*0.15, 'Not Available') "NEW CREDIT"
      FROM customers;
    3. CSELECT TO_CHAR(NVL(cust_credit_limit*0.15, 'Not Available')) "NEW CREDIT"
      FROM customers;
    4. DSELECT NVL(TO_CHAR(cust_credit_limit*0.15), 'Not Available')) "NEW CREDIT"
      FROM customers;
  2. 2View the Exhibit and examine the structure of the promotions table.
    Evaluate the following SQL statement:
    SQL>SELECT promo_name,
    CASE WHEN promo_cost >= (SELECT AVG(promo_cost) FROM promotions WHERE promo_category='TV')
    THEN 'HIGH'
    ELSE 'LOW'
    END COST_REMARK
    FROM promotions;

    Which statement is true regarding the outcome of the above query?
    Image for question 2
    1. AIt shows COST_REMARK for all the promos in the table.
    2. BIt produces an error because the SUBQUERY gives an error.
    3. CIt shows COST_REMARK for all the promos in the promo category 'TV'.
    4. DIt produces an error because SUBQUERIES cannot be used with the case expression.
  3. 3View 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 3
    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.
  4. 4Evaluate the following query:
    SQL> SELECT TRUNC(ROUND(156.00, -1), -1)
    FROM DUAL;
    What would be the outcome?
    1. A16
    2. B100
    3. C160
    4. D200
    5. E150
  5. 5Which two statements are true regarding single row functions?
    1. AMOD: returns the quotient of a division
    2. BTRUNC: can be used with number and date values
    3. CCONCAT: can be used to combine any number of values
    4. DSYSDATE: returns the database server current date and time
    5. EINSTR: can be used to find only the first occurrence of a character in a string
    6. FTRIM: can be used to remove all the occurrences of a character from a string
  6. 6Evaluate the following SQL statement:

    SQL> SELECT promo_id, promo_category
    FROM promotions
    where promo_category = 'Internet' ORDER BY 2 DESC
    UNION
    SELECT promo_id, promo_category
    FROM promotions
    where promo_category = 'TV'
    UNION
    SELECT promo_id, promo_category
    FROM promotions
    where promo_category = 'Radio';

    Which statement is true regarding the outcome of the above query?
    1. AIt executes successfully and displays rows in the descending order of PROMO_CATEGORY
    2. BIt produces an error because positional notation cannot be used in the order by clause with set operators
    3. CIt executes successfully but ignores the order by clause because it is not located at the end of the compound statement
    4. DIt produces an error because the order by clause should appear only at the end of a compound query-that is, with the last select statement
  7. 7View the Exhibit and examine the structure of the SALES table.
    The following query is written to retrieve all those product IDs from the SALES table that have more than 55000 sold and have been ordered more than 10 times.
    SQL> SELECT prod_id
    FROM sales
    WHERE quantity_sold > 55000 AND COUNT(*)>20
    GROUP BY prod_id
    HAVING COUNT(*) > 10;
    Image for question 7
    1. AIt executes successfully and generates the required result.
    2. BIt produces an error because count(*) should be specified in the SELECT clause also.
    3. CIt produces an error because count{*) should be only in the HAVING clause and not in the WHERE clause.
    4. DIt executes successfully but produces no result because COUNT (prod_id) should be used instead of COUNT (*).
  8. 8Which two statements are true regarding subqueries?
    1. AA subquery can retrieve zero or more rows.
    2. BOnly two subqueries can be placed at one level.
    3. CA subquery can be used only in SQL query statements.
    4. DA subquery can appear on either side of a comparison operator.
    5. EThere is no limit on the number of subquery levels in the WHERE clause of a SELECT statement.
  9. 9View the Exhibit and examine the structure of the CUSTOMERS table.
    You have been asked to produce a report on the customers table showing the customers details sorted in descending order of the city and in the descending order of their income level in each city.
    Which query would accomplish this task?
    Image for question 9
    1. ASELECT cust_city, cust_income_level, cust_last_name
      FROM customers
      ORDER BY cust_city desc, cust_income_level DESC;
    2. BSELECT cust_city, cust_income_level, cust_last_name
      FROM customers
      ORDER BY cust_income_level desc, cust_city DESC;
    3. CSELECT cust_city, cust_income_level, cust_last_name
      FROM customers
      ORDER BY (cust_city, cust_income_level) DESC;
    4. DSELECT cust_city, cust_income_level, cust_last_name
      FROM customers
      ORDER BY cust_city, cust_income_level DESC;
  10. 10View the Exhibit and examine the data in the products table.
    You need to display product names from the products table that belong to the 'software/other' category with minimum prices as either 2000 or 4000 and no unit
    of measure.
    You issue the following query:

    SQL> SELECT prod_name, prod_category, prod_min_price
    FROM products
    WHERE prod_category like '%Other%'
    AND (prod_min_price=2000 OR prod_min_price=4000)
    AND prod_unit_of_measure <> '';

    Which statement is true regarding the above query?
    Image for question 10
    1. AIt executes successfully but returns no result.
    2. BIt executes successfully and returns the required result.
    3. CIt generates an error because the condition specified for PROD_UNIT_OF_MEASURE is not valid.
    4. DIt generates an error because the condition specified for the prod category column is not valid.

Information

Description
Informática Quiz on SQL Fundamentals, created by Erick Navarro on 06/11/2017.
Language
English
Views
4
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?