Integrator SQL Test

12 Questions | Attempts: 134
Share

SettingsSettingsSettings
SQL Quizzes & Trivia

A quiz to test basic SQL skillz


Questions and Answers
  • 1. 

    Which function is a character manipulation function?

    • A.

      TRIM

    • B.

      REPLACE

    • C.

      TRUNC

    Correct Answer
    B. REPLACE
  • 2. 

    The customers table has these columns:CUSTOMER_ID             INT(4) NOT NULLCUSTOMER_NAME      VARCHAR(100)STREET_ADDRESS      VARCHAR(150)CITY_ADDRESS            VARCHAR(50)STATE_ADDRESS         VARCHAR(50)COUNTRY_ADDRESS    VARCHAR(50)POSTAL_CODE              VARCHAR(12)CUSTOMER_PHONE      VARCHAR(20)Which statement finds the rows in the customers table that do not have a postal code?

    • A.

      SELECT CUSTOMER_ID, CUSTOMER_NAME FROM CUSTOMERS WHERE POSTAL_CODE CONTAINS NULL

    • B.

      SELECT CUSTOMER_ID, CUSTOMER_NAME FROM CUSTOMERS WHERE POSTA_CODE = ''

    • C.

      SELECT CUSTOMER_ID, CUSTOMER_NAME FROM CUSTOMERS WHERE POSTAL_CODE IS NULL

    • D.

      SELECT CUSTOMER_ID, CUSTOMER_NAME FROM CUSTOMERS WHERE POSTAL_CODE = NULL

    Correct Answer
    C. SELECT CUSTOMER_ID, CUSTOMER_NAME FROM CUSTOMERS WHERE POSTAL_CODE IS NULL
  • 3. 

    Which statement does not correctly describe the functions and use of constraints?

    • A.

      Constraints make complex queries easy

    • B.

      Constraints enforce rules at the view level

    • C.

      Constraints enforce rules at the table level

    • D.

      Constraints prevent the deletion of a table if there are dependencies

    Correct Answer
    A. Constraints make complex queries easy
  • 4. 

    You define a multiple row subquery in the WHERE clause of a SQL query with the comparison operator "="What happens when the main query is executed?

    • A.

      The main query executes with the first value returned by the subquery

    • B.

      The main query executes with the last value returned by the subquery

    • C.

      The main query executes with all the values returned by the subquery

    • D.

      The main query fails because the multiple row sub query cannot be used with the comparison operator

    Correct Answer
    D. The main query fails because the multiple row sub query cannot be used with the comparison operator
  • 5. 

    The EMPLOYEE table contains the following columns:NAME            VARCHAR(255)SALARY         NUMERIC(10,2)HIRE_DATE    DATEWhich query gives us the names of the employees who have worked at the company for 5 or more years

    • A.

      SELECT NAME FROM EMPLOYEE WHERE DATEDIFF('YYYY', GETDATE(), HIRE_DATE) > 5

    • B.

      SELECT NAME FROM EMPLOYEE WHERE (GETDATE()-HIRE_DATE)/365 > 5

    • C.

      SELECT NAME FROM EMPLOYEE WHERE DATEDIFF('YYYY', HIRE_DATE, GETDATE()) > 5

    • D.

      SELECT NAME FROM EMPLOYEE WHERE (HIRE_DATE-GETDATE())/*365 > 5

    Correct Answer
    C. SELECT NAME FROM EMPLOYEE WHERE DATEDIFF('YYYY', HIRE_DATE, GETDATE()) > 5
  • 6. 

    You need to calculate the total number of burritos that your friends eat in a year.Which group function should you use?

    • A.

      MAX

    • B.

      MIN

    • C.

      SUM

    • D.

      COUNT

    Correct Answer
    C. SUM
  • 7. 

     A sub query can be used to:

    • A.

      Create groups of data

    • B.

      Sort data in a specific order

    • C.

      Convert data to a different format

    • D.

      Retrieve data based on an unknown condition

    Correct Answer
    D. Retrieve data based on an unknown condition
  • 8. 

    The DIET table for your co-workers has these columnsMEAL_ID             INT(10) not nullEMPLOYEE_ID    INT(10) not nullCALORIES           INT(100) The DIET table tracks the meal id, the total calories consumed, and the employee id. Which two statements retrieves the calories with an inclusive total that ranges between 800 and 1000 calories?

    • A.

      SELECT EMPLOYEE_ID, MEAL_ID, CALORIES FROM DIET RANGE ON CALORIES(800 AND 1000) INCLUSIVE

    • B.

      SELECT EMPLOYEE_ID, MEAL_ID, CALORIES FROM DIET HAVING CALORIES BETWEEN 800 AND 1000

    • C.

      SELECT EMPLOYEE_ID, MEAL_ID, CALORIES FROM DIET WHERE CALORIES BETWEEN 800 AND 1000

    • D.

      SELECT EMPLOYEE_ID, MEAL_ID, CALORIES FROM DIET WHERE CALORIES >= 800 AND

    Correct Answer
    C. SELECT EMPLOYEE_ID, MEAL_ID, CALORIES FROM DIET WHERE CALORIES BETWEEN 800 AND 1000
  • 9. 

    What does the TRUNCATE statement do?

    • A.

      Removes the table

    • B.

      Removes all the rows from a table

    • C.

      Shortens tail of the table by the specified number of rows

    • D.

      Removes all columns from the table

    Correct Answer
    B. Removes all the rows from a table
  • 10. 

    What is true regarding sub queries?

    • A.

      The inner query always sorts the results of the outer query

    • B.

      The outer query always sorts the results of the inner query

    • C.

      The outer query must return a value to the inner query

    • D.

      The inner query returns a value to the outer query

    Correct Answer
    D. The inner query returns a value to the outer query
  • 11. 

    To join N tables how many join conditions are required?

    • A.

      N+2

    • B.

      N+1

    • C.

      N-2

    • D.

      N-1

    Correct Answer
    D. N-1
  • 12. 

    What is an aggregate function?

    • A.

      Takes many rows as input and gives one output

    • B.

      Takes one row as input and gives one output

    • C.

      Takes many rows as input and gives many output

    • D.

      Takes many rows as input and gives no output

    Correct Answer
    A. Takes many rows as input and gives one output

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 24, 2011
    Quiz Created by
    Lawrencemier

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.