Mock Test-db

10 Questions

Settings
Mock Test Quizzes & Trivia

Sql questions


Questions and Answers
  • 1. 
    In a database containing information about North Carolina and its counties, how would you find the county with the most people?
    • A. 

      Filter the population field using >10,000

    • B. 

      Rank the counties by name and scroll through the list

    • C. 

      Search each county record

    • D. 

      Sort the records by population in descending order

  • 2. 
    What is the arrangement of data in a field in alphabetical order?
    • A. 

      Filing

    • B. 

      Numbering

    • C. 

      Searching

    • D. 

      Sorting

  • 3. 
    • A. 

      SUM(start_date)

    • B. 

      AVG(start_date)

    • C. 

      COUNT(start_date)

    • D. 

      MIN(start_date)

  • 4. 
    You would like to display the system date in the format “Monday, 01 June, 2001”. Which SELECT statement should you use?
    • A. 

      SELECT TO_DATE(SYSDATE, ‘FMDAY, DD Month, YYYY’) From dual;

    • B. 

      SELECT TO_CHAR(SYSDATE, ‘FMDay, DD Month, YYYY’) From dual

    • C. 

      SELECT TO_CHAR(SYSDATE, ‘FMDD, DY Month, ‘YYY’) From dual;

    • D. 

      SELECT TO_DATE(SYSDATE, 'FMDY, DDD Month, YYYY') From dual;

  • 5. 
    You are sorting data in a table in you SELECT statement in descending order. The column you are sorting on contains NULL records, where will the NULL record appears?
    • A. 

      At the beginning of the list

    • B. 

      At the end of the list

    • C. 

      In the middle of the list.

    • D. 

      At the same location they are listed in the unordered table.

  • 6. 
    What does the FORCE option for creating a view do?  
    • A. 

      Creates a view in another schema even if you don't have privileges

    • B. 

      Creates a view regardless of whether or not the base tables exist

    • C. 

      Creates a view with constraints

  • 7. 
    Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) Which statement produces the number of different departments that have employees with last name Smith?
    • A. 

      SELECT COUNT(*) FROM employees WHERE last_name=’Smith’;

    • B. 

      SELECT COUNT(dept_id) FROM employees WHERE last_name=’Smith’;

    • C. 

      SELECT COUNT(DISTINCT dept_id) FROM employees WHERE last_name=’Smith’;

    • D. 

      SELECT UNIQUE(dept_id) FROM employees WHERE last_name=’Smith’;

  • 8. 
    Evaluate these two SQL statements: SELECT last_name, salary , hire_date FROM EMPLOYEES ORDER BY salary DESC; SELECT last_name, salary , hire_date FROM EMPLOYEES ORDER BY 2 DESC; What is true about them?
    • A. 

      The two statements produce identical results.

    • B. 

      The second statement returns a syntax error.

    • C. 

      There is no need to specify DESC because the results are sorted in descending order by default.

    • D. 

      D. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement. D. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement

  • 9. 
    Which SQL statement accepts user input for the columns to be displayed, the table name, and the WHERE condition
    • A. 

      SELECT &1,

    • B. 

      SELECT &1, &2 FROM &3 WHERE last_name = ‘&4’;

    • C. 

      SELECT &1, ‘&2’ FROM &3 WHERE ‘&last_name = ‘&4’’;

    • D. 

      SELECT &1, ‘&2’ FROM EMP WHERE last_name = ‘&4’;

  • 10. 
    In a SELECT statement that includes a WHERE clause, where is the GROUP BY clause placed in the SELECT statement
    • A. 

      Immediately after the SELECT clause

    • B. 

      Before the FROM clause

    • C. 

      After the WHERE clause

    • D. 

      After the ORDER BY clause