1/22
A collection of vocabulary flashcards derived from SQL interview topics to aid in studying key terms and their definitions.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
SQL
Structured Query Language, used for interaction with relational database management systems (RDBMS). This includes fetching, updating, inserting, and removing data from tables.
What are the main applications of SQL?
Create, delete, and update tables in a database
access, manipulate, and modify data in a table
retrieve and summarize the necessary information from a table or several tables
add or remove certain rows or columns from a table.
Outer Join
returns matched values and unmatched values from either or both tables. Left Join and Right Join are considered types of Outer Join.
Use case: Useful for combining data that exists in either of the tables and capturing unmatched data from both tables.
Inner Join
returns only those records that satisfy a defined join condition in both (or all) tables. Default Join.
Use case: Used when you need to retrieve records with matching values in both tables. Commonly used for combining data that is related through a foreign key.
Cross Join
returns the Cartesian product of two tables, combining each row from the first table with every row from the second table.
Use case: Typically used when you need all combinations of two datasets, such as generating test data or exploring all possible combinations.
Left Join vs Right Join
Left Join returns all records from the left table and matched records from the right table, while Right Join returns all records from the right table and matched records from the left table. The result will include Null values in the columns of the unmatched records from the respective tables.
Use case (L): Useful for retrieving all records from the left table, with the matching data in the right table, if available. Often used when you need to find all entries in one table and see if they have corresponding entries in another.
Use case (R): Similar to LEFT JOIN but focuses on the right table. Used when you need all records from the right table whether or not they have matches in the left table.
Self Join
a join in which a table is joined with itself
Use case: Employed when you need to compare rows within the same table, such as finding relationships in hierarchical data or comparing values in various rows.
What is the difference between the WHERE and ON clauses in SQL JOINS?
The purpose of the ON clause is to specify the join conditions, in other words, to define how the tables should be joined. Specifically, you define how the records should be matched.
In contrast, the WHERE clause is used to specify the filtering conditions, that is, to define which rows should be kept in the result set. A JOIN that includes a filtering condition can be considered a conditional JOIN.
SQL Database
CREATE DATABASE: creates a new SQL database with specified name
DROP DATABASE: used to delete an existing SQL database
BACKUP DATABASE: used to create full back up of an existing SQL database
BACKUP DATABASE WITH DIFFERENTIAL: creates differential back up of an existing database. differential back up backs up only those parts of the database which have been changed since last back up.
Primary Key
A unique identifier for a record in a table, ensuring no duplicate or null values.
Foreign Key
A column that creates a relationship between two tables by linking to the primary key of another table.
Index
A data structure that improves the speed of data retrieval operations in a database.
Normalization
The process of organizing data in a way that reduces redundancy and dependency.
Denormalization
The process of combining data from multiple tables to improve read performance.
Constraint
A set of rules that defines the allowed values in a column, ensuring data integrity.
Aggregate Function
A function that performs a calculation on a set of values and returns a single value.
Scalar Function
A function that operates on a single value and returns a single value.
Transaction
A sequence of operations performed as a single logical unit of work, managed to ensure data integrity.
WHERE Clause
A clause used to specify conditions for filtering records in a SQL query.
HAVING Clause
A clause used to filter records after aggregation has been applied, often following GROUP BY.
View
A virtual table created by a query that selects data from one or more tables.