PowerPoint 5 Flashcards

1
Q

What are transactions?

A

Transactions are logical units of work that consist of one or more database operations, such as inserting, updating, or deleting data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the order of clauses in a SELECT query?

A

SELECT
FROM
WHERE
ORDER BY
HAVING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a join and what kind of joins SQL supports?

A

A join is a method of linking data between one (self-join) or more tables based on values of the common column between the tables, which are known as FOREIGN KEY columns.

There are 4 kind of joins:
1. INNER JOIN
2. LEFT JOIN
3. RIGHT JOIN
4. CROSS JOIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Tell me about the INNER JOIN clause

A

The inner join clause is used to combine rows from two tables based on a join predicate. It selects and includes only the matching rows from both tables in the result set.

The inner join only includes rows that have a matching ‘id’ in both tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Tell me about the LEFT JOIN clause

A

The left join selects all rows from the left table and combines them with matching rows from the right table based on the join condition.

If no matching rows are found, the left join still includes the row from the left table in the result set with NULL values for the columns from the right table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Tell me about the RIGHT JOIN clause

A

In summary, the right join clause selects data from the right table, including both the matching rows and the rows that have no match in the left table.

If there are no matching rows from the left table, the right join uses NULL values for the columns from the left table in the result set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Tell me about the RIGHT JOIN clause

A

In summary, the right join clause selects data from the right table, including both the matching rows and the rows that have no match in the left table.

If there are no matching rows from the left table, the right join uses NULL values for the columns from the left table in the result set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are single row functions?

A

Single row functions are functions in SQL that operate on a single row of a table and return a single value for each row.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Give an explanation of what the following single row functions do:

  1. UPPER
  2. LOWER
  3. CONCAT
  4. LENGTH
A

UPPER - converts a string to upper case

LOWER - converts a string to lower case

CONCAT - function concatenates two or more string or numerical values

LENGTH - returns the length of the input string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are views?

A

Views are virtual tables in a database that are derived from the result of a query. They provide a way to present data from one or more tables or views in a customized, logical structure, offering data independence, simplified queries, enhanced security, and data consistency.

Some of its downsides are that it might impact performance and that it’s dependent on underlying tables. If a table or column undergoes changes, the view will have to too.
(for instance; table name change or deletion of a column within a table)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Transaction Control Language(TCL)?

A

TCL is a set of SQL commands used to manage transactions within a database.

The primary purpose of TCL is to provide control over the transactional behavior of the database, ensuring data integrity and consistency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the main TCL commands?

A

COMMIT, ROLLBACK, AND SAVEPOINT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the COMMIT command used for?

A

The COMMIT command is used to permanently save the changes made within a transaction to the database.
Once a COMMIT is issued, the changes become permanent and visible to other users or processes accessing the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the ROLLBACK command used for?

A

The ROLLBACK command is used to undo all the changes made within a transaction and restore the database to its state before the transaction began.
ROLLBACK cancels the transaction, discarding any modifications made.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the SAVEPOINT command used for?

A

SAVEPOINT allows you to create a named point within a transaction to which you can later roll back.

It provides a way to create intermediate markers within a transaction, enabling partial rollback or nested transaction handling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly