sql Flashcards
What is the fundamental approach of SQL in terms of data manipulation?
they are not the core concept of SQL being set-oriented.
What is the primary difference between a declarative language like SQL and a procedural language like C++?
Declarative: In a declarative language like SQL, you specify what you want to achieve (e.g., “Select all customers from the Customers table”). The system determines how to achieve it.
What are the two primary ways SQL can be used?
interactive embedded
What is the primary function of the SELECT statement in SQL?
The primary function of the SELECT statement is to retrieve data from a relational database.
What is the primary function of the WHERE clause in a SQL SELECT statement?
While the WHERE clause can filter data horizontally (selecting specific rows based on conditions), its primary function is to apply conditions to the dataset.
Here’s a more accurate explanation:
Filtering: The WHERE clause filters rows based on specified conditions.
Conditions: These conditions are typically expressed using comparison operators (e.g., =, <, >, <>, BETWEEN, IN) and logical operators (e.g., AND, OR, NOT).
What is the primary function of the GROUP BY clause in a SQL SELECT statement?
Grouping: The GROUP BY clause specifies the columns by which you want to group the data.
Aggregation: You often use aggregate functions (like SUM, AVG, COUNT, MIN, MAX) with GROUP BY to calculate values for each group.
What is the difference between an inner join and an outer join in SQL?
Inner join:
Returns only the rows that have matching values in both tables. It’s like finding the overlap between two sets of data.
Outer join: Returns all rows from one table, even if there are no matching rows in the other table. It’s like merging two sets of data, including the parts that don’t overlap.