CIS 3050 Chapter 6

5.0(1)
studied byStudied by 62 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

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.

30 Terms

1
New cards

Join

A relational operation that causes two tables with a common domain to be combined into a single table or view.

2
New cards

Equi-join

A join in which the joining condition is based on equality between values in the common columns. Common columns appear (redundantly) in the result table.

3
New cards

Natural join

A join that is the same as an equi-join except that one of the duplicate columns is eliminated in the result table.

4
New cards

Outer join

A join that returns all the values in one of the tables included in the join, regardless of whether or not a match exists in the other table.

5
New cards

Self join

A join that joins a table with itself

6
New cards

Subquery (technique)

A subquery in which processing the inner query depends on data from the outer query.

involves placing an inner query (SELECT . . . FROM . . . WHERE) within a WHERE or HAVING clause of another (outer) query. Can be noncorrelated or correlated.

7
New cards

Noncorrelated subquery

  • Do not depend on data from the outer query

  • Execute once for the entire outer query

8
New cards

Correlated subquery

  • Makes use of data from the outer query

  • Executes once for each row of the outer query

  • Can use the EXISTS and ALL operators

9
New cards

UNION join/clause

Used to combine the output from multiple queries together into a single result table. returns a table that includes all data from each table that was joined.

10
New cards

CAST( ) function

Command that converts a value (of any type) into a specified datatype

11
New cards

CASE expression

It allows you to choose what will appear in a column of the result set, depending on a condition. It acts like an if-else statement.

12
New cards

Derived table

A subquery in the FROM clause of the outer query

13
New cards

Views

a mechanism that allows the creation of virtual tables on the foundation of the base tables.

14
New cards

Base table

A table in the relational data model containing the inserted raw data. These tables correspond to the relations that are identified in the database's conceptual schema

15
New cards

Virtual table

A table constructed automatically as needed by a DBMS. These tables are not maintained as real data.

16
New cards

Dynamic view

A “virtual table” created dynamically on request by a user. No data actually stored; instead data from base table made available to user. Based on SQL SELECT statement on base tables or other views

17
New cards

Materialized view

Copy or replication of data, data actually stored. Must be refreshed periodically to match corresponding base tables

18
New cards

Tips for Developing Queries

  • Be familiar with the data model (entities and relationships)

  • Understand the desired results

  • Know the attributes desired in results

  • Identify the entities that contain desired attributes

  • Review ERD

  • Construct a WHERE equality for each link

  • Fine tune with GROUP BY and HAVING clauses if needed

  • Consider the effect on unusual data

19
New cards

Trigger

user-defined functions that run automatically when specific conditions are fulfilled at the time when records are INSERTed, UPDATEd, or DELETEd.

20
New cards

Guidelines for Better Query Design

  • Understand how indexes are used in query processing

  • Keep optimizer statistics up to date

  • Use compatible data types for fields and literals

  • Write simple queries

  • Break complex queries into multiple simple parts

  • Don’t nest one query inside another query

  • Don’t combine a query with itself (if possible avoid selfjoins)

  • Create temporary tables for groups of queries

  • Combine update operations

  • Retrieve only the data you need

  • Don’t have the DBMS sort without an index

  • Learn!

  • Consider the total query processing time for ad hoc queries

21
New cards

Advantages of Dynamic Views

  • Simplify query commands

  • Assist with data security

  • Enhance programming productivity

  • Contain most current base table data

  • Use little storage space

  • Provide customized view for user

  • Establish physical data independence

  • Use processing time each time view is referenced

  • May or may not be directly updateable

  • As with all SQL constructs, you should use views with discretion

22
New cards

Routines

Program modules that execute on demand

23
New cards

Functions

routines that return values and take input parameters

24
New cards

Procedures

routines that do not return values and can take input or output parameters, called by name.

25
New cards

Persistent Stored Modules (SQLPSM)

Extensions defined originally in SQL:1999 that include the capability to create and drop modules of code stored in the database schema across user sessions.

26
New cards

Advantages of SQL-invoked routines

  • Flexibility

  • Efficiency

  • Sharability

  • Applicability

27
New cards

User-defined data type (UDT)

A data type that a user can define by making it a subclass of a standard type or an object type

28
New cards

Analytical functions (for OLAP)

  • CEILING, FLOOR, SQRT, RANK, DENSE_RANK, ROLLUP, CUBE, SAMPLE

  • WINDOW – improved numerical analysis capabilities

29
New cards

New Data Types

BIGINT, MULTISET (collection), XML

30
New cards

CREATE TABLE LIKE

create a new table similar to an existing one