SQL Select: The Basics

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Castle96
C
Castle96
Community Contributor
Quizzes Created: 1 | Total Attempts: 287
Questions: 12 | Attempts: 294

SettingsSettingsSettings
SQL Select: The Basics - Quiz

This is a quiz to test the knowledge of SQL basics based on a lesson given to learners.


Questions and Answers
  • 1. 

    Which of the following is NOT a commonly accepted rule for joining multiple tables?

    • A.

      It is commonly accepted to list joins between tables before other items in the WHERE clause

    • B.

      It is recommended that aliases be keywords to keep the statement uniform throughout

    • C.

      It is recommended that joins between tables are based on Primary/Foreign keys

    • D.

      Any table listed in a join statement MUST exist in the FROM element

    Correct Answer
    B. It is recommended that aliases be keywords to keep the statement uniform throughout
    Explanation
    Using keywords as an alias is NOT allowed under relational database rules. Keywords are reserved words (such as FROM, WHERE, SELECT, etc) that will return an error if attempted to be used. Most SQL editors will warn/notify the user that a keyword has been selected.

    Rate this question:

  • 2. 

    Looking at the datamodel above, select which tables would be used to return data from the columns: term_code, question_id, question_text, and scaled_response_number.

    • A.

      Course_eval_responses_detail, term_dimension

    • B.

      course_eval_section_dimension, term_dimension, response_date_dimension

    • C.

      Course_eval_responses_detail, response_date_dimension, course_eval_section_attr_dim

    • D.

      Course_eval_responses_detail, term_dimension, course_eval_question_dimension

    Correct Answer
    D. Course_eval_responses_detail, term_dimension, course_eval_question_dimension
    Explanation
    The columns dictate that there are three tables to use. Question_id and question_text can be gleaned from course_eval_question_dimension. Term_code will come from the _term_dimension...and finally, scaled_response_number will be pulled from the course_eval_responses_detail fact table.

    Rate this question:

  • 3. 

    Which of the following are OPTIONAL parts of a SQL select statement?

    • A.

      ORDER BY

    • B.

      GROUP BY

    • C.

      WHERE

    • D.

      AND/OR

    • E.

      ALL are valid optional parts

    Correct Answer
    E. ALL are valid optional parts
    Explanation
    All of the selections are possible as optional parts of the SQL. It is important that any special conditions for using the optional components are met to execute the query.

    Rate this question:

  • 4. 

    Looking at the image below, please determine what kind of key is course_eval_department_key

    • A.

      Primary

    • B.

      Foreign

    Correct Answer
    B. Foreign
    Explanation
    It is a foreign key because it is listed in a FACT table along with a number of other foreign keys. These are "links" to other tables to create joins so the dimensional data can be included with numerical type data often existing in a FACT table.

    Rate this question:

  • 5. 

    Which of the following statements, including both required and optional elements, will execute successfully?

    • A.

      SELECT department_desc WHERE department_code = '0012';

    • B.

      SELECT * FROM department_dimension;

    • C.

      SELECT department_desc FROM department_dimension ORDER BY department_code;

    • D.

      SELECT department_code, department_desc FROM department_dimension WHERE college_code in ('01','08') ORDER BY department_code;

    Correct Answer
    D. SELECT department_code, department_desc FROM department_dimension WHERE college_code in ('01','08') ORDER BY department_code;
    Explanation
    One answer only has required parts,one answer has no FROM element, and one has an order by that has a column NOT in the select.

    Rate this question:

  • 6. 

    Which of the following statements include ONLY the required elements needed to execute?

    • A.

      SELECT * FROM department_dimension

    • B.

      SELECT department_code FROM department_dimension WHERE department_code = '0012';

    • C.

      SELECT department_desc FROM department_dimension;

    • D.

      SELECT department_desc WHERE department_code = '0012';

    Correct Answer
    C. SELECT department_desc FROM department_dimension;
    Explanation
    Of the options that are incorrect, one has no semi-colon, one has no FROM element, and one includes optional parts in the statement. Only the select where department_desc is being selected from department_dimension (ending in a semi-colon) contains all 5 required elements, and ONLY those elements.

    Rate this question:

  • 7. 

    Looking at the image below, please select what kind of key term_key is in the term_dimension.

    • A.

      Primary

    • B.

      Foreign

    Correct Answer
    A. Primary
    Explanation
    It is a primary key because it is the uniquely identifying field for that table as opposed to just the key that links to a dimension with more data associated with a primary key.

    Rate this question:

  • 8. 

    Benefits of SQL includes being flexible, universal, and requires learning only a very few and simple commands

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    All statements are true. SQL is very flexible and can be used in any number of SQL applications that can connect to a relational database...and as you have learned, it takes very few commands to get started in executing a SQL select statement

    Rate this question:

  • 9. 

    Fill in the Blank.  SQL stands for ____________________________.

    • A.

      Standard Quantifying Logistics

    • B.

      Systematic Query Language

    • C.

      Structured Query Language

    • D.

      Standard Query Linguistics

    Correct Answer
    C. Structured Query Language
    Explanation
    SQL is a programming language designed for managing data held in relational databases

    Rate this question:

  • 10. 

    Please review the SQL statement below.  Will the SELECT statement execute successfully?

    • A.

      Yes

    • B.

      No

    Correct Answer
    B. No
    Explanation
    Even though this looks like a very complex statement, it will not execute because it is missing a semi-colon. Something as simple as a missing semi-colon can cause even a simple SQL statement to fail to execute. It is very important to ensure you have ALL parts of the statement every time you want to execute it.

    Rate this question:

  • 11. 

    Looking at the datamodel above, please select the column you would NOT use in a join between multiple tables if the select statement had the following columns:  department_desc, course_title, instructor_full_name, essay_response_text

    • A.

      Course_eval_section_key

    • B.

      Course_eval_question_key

    • C.

      Course_eval_department_key

    • D.

      Course_eval_instructor_key

    Correct Answer
    B. Course_eval_question_key
    Explanation
    Because there are no columns being selected from the course_eval_question_dimension, and we do not know if there is a filter using it, there is no reason to create a join using the course_eval_question_key.

    Rate this question:

  • 12. 

    What are the 5 parts of a SELECT statement that are required to execute successfully?

    • A.

      SELECT, FROM, column, semi-colon, table

    • B.

      SELECT, FROM, table, WHERE, semi-colon

    • C.

      Column, FROM, table, ORDER BY, semi-colon

    • D.

      Column, table, WHERE, ORDER BY, GROUP BY

    Correct Answer
    A. SELECT, FROM, column, semi-colon, table
    Explanation
    At a minimum, these 5 parts MUST be present to execute a SQL select statement. There are some applications that may let the user eliminate the need for a semi-colon, but it is rare. Good practice is to use it to correctly define the end of a SQL statement

    Rate this question:

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 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 12, 2013
    Quiz Created by
    Castle96

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.