โ† All ADC Flashcard Decks

Data Retrieval & Query Techniques Flashcards

9 cards from real ADC practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 9 Data Retrieval & Query Techniques flashcards as text
  1. What is the primary function of a SELECT statement in SQL?

    Answer: Retrieve data from one or more tables.

    The `SELECT` statement is the fundamental command in SQL used for querying and retrieving data from a database. It allows users to specify which columns and rows they want to view from one or more tables. Essentially, it's how you extract information stored within the database to display or use.

  2. Which clause is used to filter records in a SQL query?

    Answer: WHERE

    The `WHERE` clause in SQL is specifically used to filter records based on a specified condition. It allows you to retrieve only the rows that meet certain criteria, making your query results more precise and relevant. This is essential for narrowing down large datasets to find particular information.

  3. What does the JOIN operation accomplish in SQL?

    Answer: Combines data from multiple tables based on a common field.

    The `JOIN` operation in SQL is used to combine rows from two or more tables based on a common field between them. This allows you to retrieve a unified result set that contains data from all joined tables. It is crucial for working with relational databases where data is distributed across multiple interconnected tables.

  4. How can you sort data in ascending or descending order in SQL?

    Answer: ORDER BY

    The `ORDER BY` clause in SQL is used to sort the result set of a query. You can specify one or more columns to sort by, and choose between ascending (`ASC`) or descending (`DESC`) order. This helps in presenting data in a structured and easily understandable manner, making it easier to analyze.

  5. What is the result of using the DISTINCT keyword in a query?

    Answer: Removes duplicate rows.

    The `DISTINCT` keyword is used with the `SELECT` statement to eliminate duplicate rows from the result set. When applied, it ensures that each row returned is unique based on the values in the selected columns. This is particularly useful for obtaining a list of unique values or entries within a dataset.

  6. Which SQL function returns the number of records in a result set?

    Answer: COUNT()

    The `COUNT()` aggregate function in SQL is used to return the number of rows that match a specified criterion. It can count all rows, or only non-NULL values in a specific column, providing a quick way to determine the size of a result set or the number of entries in a particular category. It's a fundamental function for data aggregation.

  7. Which keyword is used to rename a column or table in the result set?

    Answer: AS

    The `AS` keyword in SQL is used to assign a temporary name, or alias, to a column or a table in the result set of a query. This makes column headers more readable and can simplify complex queries, especially when dealing with joins or aggregate functions. The alias only exists for the duration of that specific query.

  8. How do you retrieve records that satisfy at least one of multiple conditions?

    Answer: OR

    The `OR` logical operator in SQL is used in the `WHERE` clause to combine multiple conditions. It retrieves records where at least one of the specified conditions is true. This allows for broader filtering, including rows that satisfy any of the given criteria, making queries more flexible.

  9. What does the LIKE operator do in a SQL query?

    Answer: Searches for a pattern in text.

    The `LIKE` operator in SQL is used in the `WHERE` clause to search for a specified pattern within a text column. It is often used with wildcard characters, such as `%` (for any sequence of characters) and `_` (for any single character), to perform flexible string matching. This is invaluable for finding data that partially matches a given string.