SQL — Queries & Database Design

Preview34 cardsTechnology

Term

Primary Key

Click card to reveal

1 / 6
👋 Tap = flip

All Terms (34)

Primary Key

A unique identifier for a record in a database table.

Preview

Foreign Key

A field in a table that uniquely identifies a row in another table.

Preview

What is a JOIN operation in SQL?

A JOIN operation is used to combine rows from two or more tables based on a related column.

Preview

Normalization

The process of organizing data to minimize redundancy and improve data integrity.

Preview

Denormalization

The process of combining normalized tables to improve read performance, often at the expense of write performance.

Preview
Sign up to unlock

SELECT

An SQL command used to retrieve data from a database.

Sign up to unlock

INSERT

An SQL command used to add new rows to a table.

Sign up to unlock

UPDATE

An SQL command used to modify existing records in a table.

Sign up to unlock

DELETE

An SQL command used to remove records from a table.

Sign up to unlock

What does the SQL keyword 'DISTINCT' do?

It removes duplicate rows from the result set of a query.

Sign up to unlock

HAVING clause

Used to filter records that work on aggregated data after the GROUP BY clause.

Sign up to unlock

What is a subquery?

A subquery is a query nested inside another query, often used to perform operations in multiple steps.

Sign up to unlock

Index

A database object that improves the speed of data retrieval operations on a table.

Sign up to unlock

Aggregate Functions

Functions that perform calculations on a set of values and return a single value, such as SUM, AVG, COUNT.

Sign up to unlock

What is a stored procedure?

A stored procedure is a set of SQL statements that can be executed as a unit to perform a specific task.

Sign up to unlock

Transaction

A sequence of one or more SQL operations that are treated as a single unit of work.

Sign up to unlock

ACID properties

Atomicity, Consistency, Isolation, Durability — properties that ensure reliable processing of database transactions.

Sign up to unlock

What is a view in SQL?

A view is a virtual table based on the result set of a SELECT query.

Sign up to unlock

Data Definition Language (DDL)

A subset of SQL commands used to define and modify database structures, like CREATE, ALTER, DROP.

Sign up to unlock

Data Manipulation Language (DML)

A subset of SQL commands used to manipulate data in a database, like SELECT, INSERT, UPDATE, DELETE.

Sign up to unlock

Data Control Language (DCL)

A subset of SQL commands used to control access to data, like GRANT and REVOKE.

Sign up to unlock

Constraint

A rule applied to columns in a database table to enforce data integrity, such as UNIQUE, NOT NULL, CHECK.

Sign up to unlock

What is the purpose of the SQL 'GROUP BY' clause?

It is used to arrange identical data into groups, often used with aggregate functions.

Sign up to unlock

What is an SQL trigger?

A trigger is a procedural code that is automatically executed in response to certain events on a particular table or view.

Sign up to unlock

UNION vs UNION ALL

UNION combines results from multiple queries and removes duplicates; UNION ALL includes all duplicates.

Sign up to unlock

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only matching rows from both tables, while LEFT JOIN returns all rows from the left table and matched rows from the right.

Sign up to unlock

What is a self-join?

A self-join is a regular join, but the table is joined with itself.

Sign up to unlock

What is a composite key?

A primary key that consists of two or more columns used to identify a record uniquely.

Sign up to unlock

What is a schema in SQL?

A schema is a collection of database objects, including tables, views, and procedures, associated with a database.

Sign up to unlock

Explain the use of the 'LIKE' operator in SQL.

The 'LIKE' operator is used in a WHERE clause to search for a specified pattern in a column.

Sign up to unlock

What is SQL injection?

A code injection technique that might destroy your database, it is one of the most common web hacking techniques.

Sign up to unlock

Explain the term 'database lock'.

A mechanism to prevent simultaneous access to data in a database to ensure data integrity.

Sign up to unlock

Explain the purpose of SQL 'JOIN' types: INNER, LEFT, RIGHT, FULL.

These JOIN types determine how tables are combined: INNER returns matching rows, LEFT returns all left table rows, RIGHT returns all right table rows, FULL returns all rows when there's a match in one of the tables.

Sign up to unlock

What is the purpose of the SQL 'LIMIT' clause?

It specifies the maximum number of records to return from a query.

Sign up free to unlock all 29 cards

Free forever. No credit card needed.

Ready to study SQL — Queries & Database Design?

Free forever. No credit card needed.