Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
28 views

SQL (Interview)

The relational database model organizes data into tables composed of rows and columns. It was first proposed in 1970 and involves storing data in tables where each row represents an entity and each column represents an attribute. Key concepts include tables, primary keys to uniquely identify rows, foreign keys to link tables, and relationships like one-to-one, one-to-many, and many-to-many. Normalization reduces redundancy through decomposing tables and defining relationships, while SQL is used to query and maintain relational databases.

Uploaded by

ratnadepp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

SQL (Interview)

The relational database model organizes data into tables composed of rows and columns. It was first proposed in 1970 and involves storing data in tables where each row represents an entity and each column represents an attribute. Key concepts include tables, primary keys to uniquely identify rows, foreign keys to link tables, and relationships like one-to-one, one-to-many, and many-to-many. Normalization reduces redundancy through decomposing tables and defining relationships, while SQL is used to query and maintain relational databases.

Uploaded by

ratnadepp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

The relational database model is a type of database model that stores data in tables, which are

composed of rows and columns. This model was first proposed by E.F. Codd in 1970. In a relational
database, each row represents a unique instance of the entity defined by the table, and each column
represents an attribute of that entity. Here are the key concepts associated with the relational database
model:

1. Tables (Relations)

A table, also known as a relation, represents a subject or an entity. Each table consists of rows and
columns, where:

• Row: Also known as a tuple or record, a row represents a single, implicitly structured data item
in a table.

• Column: Also known as an attribute, a column contains all the data of a specific type within the
table.

2. Primary Key

Each table has a primary key, which is a column (or a set of columns) that uniquely identifies each row in
the table. No two rows can have the same primary key value.

3. Foreign Key

A foreign key is a column (or a set of columns) in one table that uniquely identifies a row of another
table or the same table. It is used to establish a link between the data in two tables.

4. Relationships

Relationships represent how data in one table is related to data in another. There are several types of
relationships in a relational database:

• One-to-One: Each row in Table A is linked to no more than one row in Table B, and vice versa.

• One-to-Many (or Many-to-One): Each row in Table A can be linked to many rows in Table B, but
a row in Table B is linked to only one row in Table A.

• Many-to-Many: Rows in Table A can be linked to many rows in Table B, and vice versa. This is
usually implemented using a junction table.

5. Integrity Constraints

These are rules that ensure the quality and the consistency of the data in the database. They include:

• Entity Integrity: Ensuring that every table has a primary key and that the data within it is unique
and not null.

• Referential Integrity: Ensuring that foreign keys correctly refer to the primary keys of the
referenced tables.

6. Normalization
Normalization is the process of organizing data in a database to reduce redundancy and improve data
integrity. It involves dividing large tables into smaller, less redundant tables and defining relationships
between them.

7. SQL (Structured Query Language)

SQL is the standard language used for querying and maintaining relational databases. It allows users to
create, read, update, and delete data in a relational database.

8. ACID Properties

The ACID properties (Atomicity, Consistency, Isolation, Durability) are a set of principles that ensure
reliable processing of database transactions.

Advantages of the Relational Database Model:

• Flexibility in adding and altering tables.

• Simplicity of design.

• Data accuracy and integrity.

• Ease of use with SQL.

• Strong security features.

Disadvantages:

• Performance can slow with large volumes of data.

• Complex relationships between data can be difficult to manage.

• May require more memory and processing power than other database models.

Relational databases are widely used in various applications such as finance, human resources, customer
relationship management (CRM), and more. Some popular relational database management systems
(RDBMS) include MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, and SQLite.

In the context of a relational database, the terms "key," "foreign key," and "primary key" have specific
meanings related to how data is organized and maintained within the database:

Key:

A key is a generic term used in the context of relational databases to refer to one or more columns of a
table that are used to identify a record and establish relationships between different tables. Keys help to
ensure that each record within a table can be uniquely identified and accessed. There are different types
of keys, such as primary keys, foreign keys, candidate keys, unique keys, etc.

Primary Key:

A primary key is a field (or collection of fields) in a table that uniquely identifies each row in that table.
Every table should have a primary key because it ensures the row's identity, and it is used to establish a
relationship with foreign keys in other tables. A primary key must contain unique values, and it cannot
contain NULL values. A table can have only one primary key, which can consist of single or multiple
columns (composite primary key).

Foreign Key:

A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table
or the same table (in case of a recursive relationship). Essentially, a foreign key is a reference to a
primary key in another table. The purpose of the foreign key is to enforce referential integrity within the
data. It ensures that the relationship between two tables remains synchronized during updates and
deletions. If a table has a foreign key to another table, the concept of foreign key constraint comes into
play; this means that every value of the foreign key must correspond to an existing, matching value of
the primary key in the referenced table, or it must be null.

Example:

Imagine you have two tables: Customers and Orders.

• The Customers table has a column CustomerID which is the primary key.

• The Orders table has a column OrderID as its primary key, and also a column CustomerID which
is a foreign key that references the CustomerID in the Customers table.

This relationship allows you to keep each customer's information in one record in the Customers table
and associate each order with the correct customer through the CustomerID foreign key in the Orders
table.

Normalization is a systematic approach of decomposing tables to eliminate data redundancy (repetition)


and undesirable characteristics like Insertion, Update, and Deletion Anomalies. It is a multi-step process
that puts data into tabular form, removing duplicated data from the relation tables.

Normalization is used for mainly two purposes:

1. Eliminating redundant (useless) data.

2. Ensuring data dependencies make sense (i.e., data is logically stored).

The process of normalization is achieved through a series of steps known as normal forms. Each
consecutive normal form depends on the previous one. The most common normal forms are as follows:

First Normal Form (1NF)

This is the basic level of database normalization. A table is in 1NF if:

• Each column contains atomic values, and there are no repeating groups or arrays.

• Entries in any column must be of the same data type.

• Each column must have a unique name.

• The order in which data is stored does not matter.

Second Normal Form (2NF)


A table is in 2NF if:

• It is in 1NF.

• All non-key columns are fully dependent on the primary key (i.e., no partial dependency). This
means that each non-key column should be dependent on the whole primary key, not just part
of it (for composite primary keys).

Third Normal Form (3NF)

A table is in 3NF if:

• It is in 2NF.

• There is no transitive dependency for non-key attributes. Transitive dependency means that non-
key attributes do not depend on other non-key attributes.

Boyce-Codd Normal Form (BCNF)

A table is in BCNF if:

• It is in 3NF.

• For any dependency �→�A→B, A should be a super key. A super key is a set of columns such
that the values of these columns are unique across various rows.

There are also higher levels of normalization like the Fourth Normal Form (4NF), which deals with multi-
valued dependencies, and the Fifth Normal Form (5NF), which deals with more complex scenarios of join
dependencies.

Normalization trades off a bit of efficiency for improvements in:

• Reducing the amount of data redundancy.

• Minimizing the potential for inconsistencies in the database.

• The ease of maintenance and data integrity.

In practice, most databases are normalized to the third normal form. Going beyond 3NF is often not
necessary unless the specific structure of the data requires it. It's also important to note that sometimes,
for performance reasons, a database might be denormalized. Denormalization involves adding
redundant data to one or more tables to improve database read performance, although this can
introduce the potential for data anomalies and requires careful planning and management.
A transaction in the context of a database is a sequence of one or more SQL operations that are treated
as a single unit of work. A transaction must be completed in its entirety or not executed at all to maintain
the integrity of the database. If a transaction is executed partially, it could leave the database in an
inconsistent state.

The ACID properties describe the key characteristics of a transaction in a database management system.
ACID stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure that database
transactions are processed reliably:

Atomicity

Atomicity guarantees that all operations within a work unit are completed successfully. If any part of the
transaction fails, the entire transaction fails, and the database state is left unchanged. Essentially, a
transaction must be "all or nothing": if an error occurs during the transaction, all changes made up to
that point are rolled back.

Consistency

Consistency ensures that a transaction can only bring the database from one valid state to another. This
means that the transaction must conform to all rules and constraints set on the database (e.g., foreign
key constraints, triggers, cascades, etc.). After the transaction has been committed, the database
integrity must be intact.

Isolation

Isolation determines how transaction integrity is visible to other users and systems. A transaction should
be isolated from other transactions running concurrently, preventing data corruption caused by
concurrent changes. Isolation is typically achieved through concurrency control mechanisms such as
locks. The level of isolation, however, can be adjusted because higher levels of isolation usually come at
the cost of system performance.

Durability

Durability ensures that once a transaction has been committed, it will remain so, even in the event of
power loss, crashes, or errors. This means that the changes made by the transaction are permanently
stored in the database and are made persistent.

Database systems implement these ACID properties through various means, including transaction logs,
locks, and other mechanisms that ensure the safe and reliable processing of transactions. Transactions
are a critical concept in database systems that allow multiple operations to be executed as a single
logical unit, providing a safe and predictable way to manage database state changes.
In SQL, a "join" is used to combine rows from two or more tables, based on a related column between
them. Here are the different types of joins with examples in SQL code:

INNER JOIN

Returns records that have matching values in both tables.

sqlCopy code

SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON


Orders.CustomerID = Customers.CustomerID;

LEFT (OUTER) JOIN

Returns all records from the left table, and the matched records from the right table. If there is no
match, the result is NULL on the right side.

sqlCopy code

SELECT Customers.CustomerName, Orders.OrderID FROM Customers LEFT JOIN Orders ON


Customers.CustomerID = Orders.CustomerID;

RIGHT (OUTER) JOIN

Returns all records from the right table, and the matched records from the left table. If there is no
match, the result is NULL on the left side.

sqlCopy code

SELECT Customers.CustomerName, Orders.OrderID FROM Customers RIGHT JOIN Orders ON


Customers.CustomerID = Orders.CustomerID;

FULL (OUTER) JOIN

Returns all records when there is a match in either left or right table. Records that do not have a match
in the other table are also returned with NULL in the place of missing columns.

sqlCopy code

SELECT Customers.CustomerName, Orders.OrderID FROM Customers FULL OUTER JOIN Orders ON


Customers.CustomerID = Orders.CustomerID;

CROSS JOIN

Returns all records where each row from the first table is combined with each row from the second
table.

sqlCopy code

SELECT Customers.CustomerName, Products.ProductName FROM Customers CROSS JOIN Products;

This will produce a Cartesian product of the two tables, which can be very large.

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

sqlCopy code

SELECT A.CustomerName AS CustomerName1, B.CustomerName AS CustomerName2, A.City FROM


Customers A INNER JOIN Customers B ON A.CustomerID = B.CustomerID WHERE A.City = B.City AND
A.CustomerID <> B.CustomerID;

This is useful for finding rows in a table that share a common attribute.

NATURAL JOIN

A natural join is a type of join that automatically performs an INNER JOIN between two tables based on
all columns with the same name and compatible data types.

sqlCopy code

SELECT * FROM Orders NATURAL JOIN Customers;

This query would join Orders and Customers based on all columns that appear in both tables with the
same name.

JOIN with USING clause

If several columns have the same names but the join should only happen over one of them, the USING
clause can be used.

sqlCopy code

SELECT * FROM Orders JOIN Customers USING (CustomerID);

This joins Orders and Customers where the CustomerID is the same in both tables.

JOIN with ON clause

Used to specify the condition for the join.

sqlCopy code

SELECT * FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID;

This is the most common way to join tables, specifying exactly which fields to match.

SQL joins are a powerful feature that allows for complex queries across multiple tables, and
understanding them is fundamental for anyone working with relational databases.
String functions are used to manipulate, examine, and change string data in various ways. Here are some
of the most commonly used string functions in SQL, which are supported by most relational database
management systems like MySQL, PostgreSQL, Oracle, SQL Server, and SQLite:

1. CONCAT()

Concatenates two or more strings into one string.

sqlCopy code

SELECT CONCAT('Hello', ', ', 'World!'); -- Result: 'Hello, World!'

2. LENGTH() or LEN() (depending on the RDBMS)

Returns the length of a string (number of characters).

sqlCopy code

SELECT LENGTH('Hello World'); -- Result: 11

3. UPPER() and LOWER()

Converts a string to upper-case or lower-case characters.

sqlCopy code

SELECT UPPER('Hello World'); -- Result: 'HELLO WORLD' SELECT LOWER('Hello World'); -- Result: 'hello
world'

4. LTRIM() and RTRIM()

Removes spaces from the beginning or end of a string.

sqlCopy code

SELECT LTRIM(' Hello World '); -- Result: 'Hello World ' SELECT RTRIM(' Hello World '); -- Result: ' Hello
World'

5. TRIM()

Removes spaces or a specified set of characters from the beginning and end of a string.

sqlCopy code

SELECT TRIM(' Hello World '); -- Result: 'Hello World' SELECT TRIM(BOTH 'x' FROM 'xxHello Worldxx'); --
Result: 'Hello World'

6. SUBSTRING() or SUBSTR()

Extracts a substring from a string (starting at any position).

sqlCopy code

SELECT SUBSTRING('Hello World', 1, 5); -- Result: 'Hello' SELECT SUBSTRING('Hello World', 7); -- Result:
'World'
7. CHAR_LENGTH() or CHARACTER_LENGTH()

Returns the number of characters in a string (similar to LENGTH()).

sqlCopy code

SELECT CHAR_LENGTH('Hello World'); -- Result: 11

8. POSITION()

Returns the position of the first occurrence of a substring in a string.

sqlCopy code

SELECT POSITION('World' IN 'Hello World'); -- Result: 7

9. REPLACE()

Replaces all occurrences of a substring within a string with a new substring.

sqlCopy code

SELECT REPLACE('Hello World', 'World', 'SQL'); -- Result: 'Hello SQL'

10. REVERSE()

Reverses a string.

sqlCopy code

SELECT REVERSE('Hello World'); -- Result: 'dlroW olleH'

11. LEFT() and RIGHT()

Returns a specified number of characters from the left or right side of a string.

sqlCopy code

SELECT LEFT('Hello World', 5); -- Result: 'Hello' SELECT RIGHT('Hello World', 5); -- Result: 'World'

These functions are widely used in data retrieval, cleaning, transformation, and reporting. The syntax
may vary slightly depending on the database system, so it's always good to check the specific
documentation for the SQL dialect you are using.
1. Finding records that start with "a"

sqlCopy code

SELECT * FROM table WHERE column LIKE 'a%';

This will match any value that starts with "a", such as "apple", "adam", "a".

2. Finding records that end with "a"

sqlCopy code

SELECT * FROM table WHERE column LIKE '%a';

This will match any value that ends with "a", such as "pizza", "mozzarella", "a".

3. Finding records that contain "a"

sqlCopy code

SELECT * FROM table WHERE column LIKE '%a%';

This will match any value that has "a" in any position, such as "apple", "banana", "grape".

4. Finding records that have "a" as the second character

sqlCopy code

SELECT * FROM table WHERE column LIKE '_a%';

This will match any value where "a" is the second character, such as "bar", "car", but not "ab".

5. Finding records that start with "a" and are at least 3 characters in length

sqlCopy code

SELECT * FROM table WHERE column LIKE 'a_%_%';

This will match any value that starts with "a" and has at least two more characters, like "apple" but not
"an".

6. Finding records that start with "a" and end with "e"

sqlCopy code

SELECT * FROM table WHERE column LIKE 'a%e';

This will match any value that starts with "a" and ends with "e", such as "apple", "ace".

7. Finding records that have "a" in the second position and "e" in the last position

sqlCopy code

SELECT * FROM table WHERE column LIKE '_a%e';

This will match values like "grape", "cake".


8. Finding records that have "a" in the second position and exactly 3 characters long

sqlCopy code

SELECT * FROM table WHERE column LIKE '_a_';

This will match three-letter words where "a" is in the middle, such as "cat", "bat".

The LIKE operator is case-insensitive in some databases (like MySQL) but case-sensitive in others (like
PostgreSQL). Always check the documentation for the specific behavior in the SQL dialect you are using.
If you need case-sensitive search in MySQL, you can use BINARY like this:

sqlCopy code

SELECT * FROM table WHERE BINARY column LIKE 'a%';

This will make the LIKE comparison case-sensitive in MySQL.


Common Table Expressions (CTEs) and subqueries are both SQL concepts that allow you to compose
complex queries. They can often be used interchangeably to achieve similar results, but there are some
differences in how they operate and when one might be preferred over the other.

Common Table Expressions (CTEs)

A CTE is a temporary result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE
statement. CTEs are defined using the WITH clause.

Advantages of CTEs:

• Readability: CTEs can make complex queries more readable by breaking them down into simpler
blocks.

• Maintainability: CTEs allow for more maintainable code as they can be organized and reused
within the query.

• Recursive Queries: CTEs support recursive queries, which are not possible with regular
subqueries.

Example of a CTE:

sqlCopy code

WITH Sales_CTE (SalesPersonID, TotalSales) AS ( SELECT SalesPersonID, SUM(TotalSaleAmount) FROM


Sales GROUP BY SalesPersonID ) SELECT * FROM Sales_CTE WHERE TotalSales > 500000;

Subqueries

A subquery is a query nested inside another query, such as SELECT, INSERT, UPDATE, or DELETE. It can be
used anywhere an expression is allowed.

Advantages of Subqueries:

• Scope: The scope of a subquery is limited to the specific part of the statement in which it is
nested.

• Execution: Some RDBMSs can optimize subqueries in certain situations better than CTEs.

Example of a Subquery:

sqlCopy code

SELECT * FROM (SELECT SalesPersonID, SUM(TotalSaleAmount) AS TotalSales FROM Sales GROUP BY


SalesPersonID) AS SalesSub WHERE TotalSales > 500000;

CTE vs Subquery

• Performance: There's a common misconception that CTEs are always superior to subqueries in
terms of performance. However, this is not necessarily true; the actual performance depends on
the specific query and how the database's query planner optimizes it.
• Recursion: CTEs can be recursive; subqueries cannot. This makes CTEs essential for hierarchical
or tree-structured data queries.

• Usage: CTEs can be more readable and easier to maintain, especially when used to break up a
complex query into simpler parts. Subqueries can be less clear, particularly if they are nested
deeply.

• Scope: CTEs have a wider scope and can be reused within the same query, while subqueries are
defined and used at the point of their declaration.

In terms of which to use, it often comes down to the specific requirements of the query and personal or
organizational style and standards. Recursive operations require CTEs, but for non-recursive queries,
either could be used, and the choice might be made on the basis of readability or the preferences of the
SQL developer.
The GROUP BY clause and the PARTITION BY clause in SQL are both used to organize rows into groups.
However, they serve different purposes and are used in different contexts.

GROUP BY Clause

The GROUP BY clause is used with aggregate functions (like COUNT(), SUM(), AVG(), MAX(), MIN()) to
group the result set by one or more columns. The GROUP BY clause combines all rows with the same
value in the specified column(s) into a single row that represents that group. When GROUP BY is used,
the query can only select the group-level attributes, aggregate functions, or constants.

Example of GROUP BY:

Suppose you have a sales table and you want to get the total sales per salesperson:

sqlCopy code

SELECT SalesPerson, SUM(SalesAmount) AS TotalSales FROM Sales GROUP BY SalesPerson;

This will produce a result set where each salesperson is listed alongside their total sales. Each row
corresponds to one salesperson.

PARTITION BY Clause

The PARTITION BY clause is used in window functions. It does not reduce the number of rows returned
by the query (unlike GROUP BY), but rather allows you to apply a window function (like
ROW_NUMBER(), RANK(), SUM()) to a subset of rows, or "window," with the same value in the specified
column(s). Each row retains its identity, and additional information calculated by the window function is
included in the output.

Example of PARTITION BY with ROW_NUMBER():

Continuing with the sales table, if you want to assign a rank to each sale within each salesperson's
results without grouping them into a single row, you would use PARTITION BY:

sqlCopy code

SELECT SalesPerson, SalesAmount, ROW_NUMBER() OVER (PARTITION BY SalesPerson ORDER BY


SalesAmount DESC) AS SaleRank FROM Sales;

This query will list all sales, but within each salesperson's block of sales, it will assign a rank based on the
sales amount, starting from 1 for the highest sale amount.

Key Differences

• Result Set Size: GROUP BY compresses the data into fewer rows by grouping. PARTITION BY
does not compress the result set; it still shows all rows.

• Use Case: GROUP BY is used when you want to aggregate data. PARTITION BY is used when you
want to perform calculations across subsets of the data while still returning individual row
details.
• Syntactic Context: GROUP BY is used at the end of a SELECT statement. PARTITION BY is part of
the OVER() clause in window functions.

Using GROUP BY, you'll typically get fewer rows in your result set because it combines rows into groups.
Using PARTITION BY, you'll get the same number of rows as your original set, just with additional
columns containing the calculated window function values.
UNION and UNION ALL are both SQL operations that allow you to combine the result sets of two or
more SELECT statements. However, they handle duplicates differently.

UNION

The UNION operator is used to combine the result sets of two or more SELECT statements and
eliminates duplicate rows from the result set. The SELECT statements within the UNION must have the
same number of columns in the result sets with similar data types. The columns in each SELECT
statement must also be in the same order.

Example of UNION:

sqlCopy code

SELECT column_name FROM table1 UNION SELECT column_name FROM table2;

This will return all distinct values of column_name from both table1 and table2. If there are duplicate
values of column_name in both table1 and table2, each duplicate will appear only once in the result set.

UNION ALL

The UNION ALL operator is used to combine the result sets of two or more SELECT statements including
all duplicates. It does not eliminate duplicates and, as a result, it is faster than UNION because it does
not have to perform the additional step of removing duplicates.

Example of UNION ALL:

sqlCopy code

SELECT column_name FROM table1 UNION ALL SELECT column_name FROM table2;

This will return all values of column_name from both table1 and table2. If there are duplicate values of
column_name in the two tables, each duplicate will appear in the result set as many times as it is found.

Key Differences:

• Duplicates: UNION removes duplicates, UNION ALL does not.

• Performance: UNION ALL is faster than UNION because it does not involve the overhead of
checking for and removing duplicates.

• Use Cases: Use UNION when you need a result set with unique values. Use UNION ALL when
you want to include all records, including duplicates, or when you know there are no duplicates
between the result sets.

It is important to note that both UNION and UNION ALL require that the corresponding columns in the
result sets of the SELECT statements are of compatible types.
RANK() and DENSE_RANK() are both SQL window functions that assign rankings to rows in the result set
based on the values of a specified column. While they are similar in their general purpose, they differ in
how they handle ties — that is, rows with equal values in the ranking column.

RANK()

The RANK() function assigns a unique rank to each distinct value in the partition, but when it encounters
ties, it leaves gaps in the ranking sequence. For example, if two rows tie for first place, they both receive
a rank of 1, but the next rank after the tie will be 3, not 2, reflecting the two tied rows that came before
it.

Example of RANK():

sqlCopy code

SELECT column_name, RANK() OVER (ORDER BY column_name) AS 'Rank' FROM table_name;

If the column_name values are (5, 5, 3, 2), the RANK() function would assign the ranks (3, 3, 2, 1).

DENSE_RANK()

The DENSE_RANK() function also assigns a unique rank to each distinct value in the partition, but unlike
RANK(), it does not leave gaps in the ranking sequence when there are ties. If two rows tie for a rank,
they both receive the same rank, and the next rank issued will be the immediately following integer.

Example of DENSE_RANK():

sqlCopy code

SELECT column_name, DENSE_RANK() OVER (ORDER BY column_name) AS 'DenseRank' FROM


table_name;

If the column_name values are (5, 5, 3, 2), the DENSE_RANK() function would assign the ranks (2, 2, 1,
1).

Key Differences:

• Gaps in Rank: RANK() leaves gaps after ties, while DENSE_RANK() does not.

• Consecutive Ranking: DENSE_RANK() always assigns consecutive rankings.

• Use Cases: Use RANK() when you need to understand the position of a row in the context of its
set (e.g., if you want the silver medalist to be #3 if there are two gold medalists). Use
DENSE_RANK() when you want to assign ranks without gaps (e.g., if you want the silver medalist
to be #2 regardless of the number of gold medalists).

Both functions are used when you want to assign rankings to rows in a query result based on the values
of one or more columns. They are typically used in the context of reporting and analysis within SQL
queries.

You might also like