(SQL) Advance Database 2 (Prelim)

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards

Common Table Expression (CTE)

specifies a temporary named result set.

2
New cards

WITH

CTE Can be defined using the ____ operator

3
New cards

SELECT, INSERT, UPDATE, or DELETE

Can be referenced within another _____, ______, ______, statement

4
New cards

ORDER BY, INTO, and OPTION

Clauses like _____, _____, ____ cannot be used in CTE queries

5
New cards

Non-Recursive CTE

•This type of CTE doesn’t use repeated procedural loops/recursion

•This type of CTE Easier to understand

6
New cards

Recursive CTE

This type of CTE uses recursion

•This type of CTE is useful when working with hierarchical data because the CTE continues to execute until the query returns the entire hierarchy

7
New cards

Subqueries

A query (SELECT statement) inside another query

8
New cards

In WHERE clause

work as part of the row selection process.

  • A subquery often found in the _______ clause

  • Also called nested subqueries.

9
New cards

In FROM clause

Returns a temporary or virtual table

  • Useful in data warehousing application

  • Also called an inline view or derived table

10
New cards

In SELECT clause

a subquery that is nested in the list of another SELECT statement

11
New cards

In IN operator

allows users to match one item from any of those in the list

12
New cards

ANY operator

This operator returns true if any of the subquery values satisfy the condition

13
New cards

ALL operator

This operator returns true if all the subquery values meet the condition

14
New cards

Correlated Subqueries

are used to select data from a table referenced in the outer query.

  • Cannot be executed independently as a simple subquery

  • A ______ subquery is executed repeatedly, once for each row evaluated by the outer query.

  • Also known as a repeating subquery

15
New cards

In EXISTS operator

used to check whether a subquery produces any rows of query results.

  • Commonly used with correlated subqueries

16
New cards

Views

a virtual table that is constructed from other tables or views and saved as an object in the database

17
New cards

Index

Used to speed up searches/queries, resulting in high performance

18
New cards

Frequency of search

creating an index to a particular column that is frequently searched can give performance benefits.

19
New cards

Size of table

putting an index on a relatively large table that contains a great number of rows can improve performance.

20
New cards

Number of updates

a database that is frequently updated should have fewer indexes as it slows the performance of inserts, updates, and deletes

21
New cards

Space considerations

create an index only if necessary, because indexes take up spaces within the database.

22
New cards

Single-Column Indexes

This type of index based on only one table column

Ex: CREATE INDEX ix_CustomerID ON Customers (CustomerID)

23
New cards

Unique Indexes

This type of index does not allow any duplicate values to be inserted into the table

Ex:

CREATE UNIQUE INDEX ix_ItemID ON Items (ItemID)

24
New cards

Composite Indexes

This type of index based on two or more columns of a table.

Ex: CREATE INDEX ix_OrderRecords ON Orders (OrderID,OrderDate, CustomerID, ItemID)

25
New cards

Dropping Index

deleting an index can be done using the DROP command.

Ex.DROP INDEX Orders.ix_OrderRecords