SELECT DECK 2 Flashcards

1
Q

What’s the basic form of a query in SQL?

A

SELECT . . . FROM . . . WHERE

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

What happens if you use the asterisk wildcard after the SELECT keyword in a query?

A

SELECT returns all columns.

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

Unless specified otherwise, the results of a query are returned in (Alpha, Numeric, Random) order?

A

Random.

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

What clause is used to set a sort order on returned query results?

A

ORDER BY

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

What keyword is added to ORDER BY to specify a descending sort?

A

DESC

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

What is the default sort for ORDER BY?

A

Ascending.

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

In this example, what does select_list represent? SELECT select_list FROM source_list

A

The list of columns from which data is returned by the query.

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

In this example, what does source_list represent? SELECT select_list FROM source_list

A

The list of tables or views from which the query gathers data.

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

What is a VIEW?

A

A VIEW is a database object which presents data gathered from other tables or views.

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

What is a SCHEMA OBJECT?

A

A SCHEMA OBJECT is a logical strcture stored within a SCHEMA.

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

What is a SCHEMA?

A

A SCHEMA is a description of data, including tables, fields, tuples and relationships within a database.

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

What is a SCHEMA in Oracle?

A

Same as a normal SCHEMA, except that in Oracle it’s also synonymous with a User.

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

In SQL, a . . . is the basic unit of storage which holds all user-accessible data.

A

TABLE

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

In SQL, each TABLE contains . . . that represent individual RECORDS.

A

ROWS

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

In SQL, each TABLE contains ROWS that represent individual . . .

A

RECORDS

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

In SQL, rows are composed of COLUMNS that represent individual . . . for each record.

A

FIELDS

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

In SQL, rows are composed of . . . that represent individual FIELDS for each record.

A

COLUMNS

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

What’s the Relational Algebra name for a ROW?

A

Tuple

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

What’s the Relational Algebra name for a COLUMN?

A

Attribute

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

What’s the Relational Algebra name for a TABLE?

A

Relation

21
Q

What is an INDEX?

A

I’ll have to plug a definition in here.

22
Q

What is a SEQUENCE?

A

A SEQUENCE is created to generate a serial list of unique integers for numeric columns, each of which is an ID for a single record.

23
Q

What is a SYNONYM?

A

A SYNONYM is an alias for schema objects.

24
Q

What are STORED SUBPROGRAMS?

A

Store subprograms are procedures and functions stored within the db.

25
Q

What’s another name for STORED SUBPROGRAMS?

A

Schema-level subprograms.

26
Q

What’s another name for SCHEMA-LEVEL SUBPROGRAM?

A

Stored subprograms.

27
Q

What is a SCHEMA-LEVEL SUBPROGRAM?

A

Schema-level subprograms are procedures and functions stored within the db.

28
Q

Can a STORED SUBPROGRAM be called by an external client app?

A

A stored subprogram can be called by any client app that can access the db.

29
Q

What is a TRIGGER?

A

A TRIGGER is a stored subprogram that is run automatically when specified events occur in a table or view.

30
Q

What is a PACKAGE?

A

A PACKAGE is a group of related subprograms, along with the explicit cursors and variables they use, stored in a db for continued use.

31
Q

Can a PACKAGE be invoked by an external app?

A

A PACKAGE can be invoked by any client app that can access the DB.

32
Q

In a SELECT clause, how are individual columns specified for output?

A

By listing the column names after the SELECT keyword and separating them with commas.

33
Q

How can you specify string matching in a query?

A

Use the LIKE operator in the WHERE clause.

34
Q

What does the percent-sign wildcard match in the LIKE operator?

A

Any number of chars.

35
Q

How do you define the string to be matched with the LIKE operator?

A

Surround it, including any wildcards, with single quotes.

36
Q

What operator is used to test whether a column or expression falls within a range of two boundary values?

A

BETWEEN

37
Q

How is the BETWEEN operator used?

A

BETWEEN lowval AND highval

38
Q

What operator is used to test whether an item is among a set of literal values?

A

IN

39
Q

How is the IN operator used?

A

The list of literal values is comma-separated and enclosed by parens.

40
Q

Can the IN operator test for char or date values?

A

Yes, but they must be delimited with single quotes.

41
Q

How do you specify char or date values to test for with the IN operator?

A

They must be delimited with single quotes.

42
Q

What are the two wildcard chars used by the LIKE operator?

A

% and _ (percent and underscore)

43
Q

What is the meaning of the % wildcard in the LIKE operator?

A

It specifies zero or more chars.

44
Q

What is the meaning of the _ wildcard in the LIKE operator?

A

It specifies exactly one char.

45
Q

What happens if you use only the “%” wildcard in the LIKE operator?

A

The query returns every nonNULL value.

46
Q

What happens if you use no wildcard for the LIKE operator’s search string?

A

In that case, LIKE behaves as an equality operator.

47
Q

What if you want to use LIKE to search for a percent or underscore?

A

Escape it with a leading backslash.

48
Q

What is the traditional escape char in a LIKE operator?

A

The backslash ( \ ).

49
Q

How do you declare an alternative escape symbol in the LIKE operator?

A

Single-quote the char with the keyword ESCAPE after the search clause.