Week 10/11 Flashcards

1
Q

Physical vs Logical objects

Do physical objects grow in size/occupy disk space? How about logical objects? What are some examples of both?

A

Physical objects occupy diskspace and grow in size. Think tables, indexes, materialized views

Logical objects do not occupy disk space and do not grow in size. Think views, sequences, synonyms, procedures, functions, triggers.

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

How do indexes optimize the retrieval process?

A

They speed up select statements

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

Every primary key and unique key column constraint automatically has an

A

index

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

How can users create an index?

A

CREATE INDEX

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

What is the drawback of Indexes?

A

They slow down DML in order to maintain the index (Insert something, Index must be updated)

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

What are sequence generated values generally used for?

A

Primary key values in tables

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

Are sequences linked to tables?

A

No, but it’s good practice to create a dedicated sequence for a tables column

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

What sort of pseudo columns do sequences use to return values?

A

<sequenceName>.currvalue and <sequenceName>.nextval
</sequenceName></sequenceName>

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

What are synonyms used for?

A

To shorten complex table/view names. They do not replace the name.

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

PL/SQL can do programming other than DB programming

A

False, it’s restricted

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

PL/SQL can have any number of statements, which reduces network traffic. This means that DB operations can be sent to the server in one large unit, rather than many separate statements

A

True. This minimizes network traffic.

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

T/F – With PL/SQL, the program must reside at the front end

A

False, it can reside on the front end or within the Oracle DB server as a stored subprogram

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

What sort of PL/SQL subprograms can be stored in the database?

A

Procedures, Functions, Triggers, Packages

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

PL/SQL Sub-programs can be

A

Anonymous Blocks or Named Sub Programs

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

What do stored sub programs do?

A

They promote reusability, better performance, programmability

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

What types of SQL statements are valid in PL/SQL, what types are not?

A

Valid: DML(insert), TCL (Commit, Rollback), SQL functions
Invalid: DDL(Create), DCL(Grant, Revoke)

17
Q

For anonymous block PL/SQL syntax, which are optional and which are mandatory?
Declare, Begin, Exception

A

Declare and Exception and optional, Begin is mandatory

18
Q

Scalar vs Composite variable types: what’s the simple difference

A

Scaler = 1 value
Composite = 2 values

19
Q

Procedures are generally used for ___ or SELECT, functions are used for ____________

A

DML, calculations

20
Q

Functions must return…

A

a single value

21
Q

What are Data Dictionary Views? (DDVs)

A

Views that can show you information on procedures, functions, packages

22
Q

2 Types of triggers in PL/SQL

A

Schema level, System

23
Q

Schema level vs System triggers go

A

Schema - based on a particular table in a schema
System - Database-wide triggers

24
Q

What are the 3 things we must decide when creating a trigger

A

The time, event, and type

25
Q

What do the time, event and type mean in reference to triggers

A

Time = before or after event
Event = The event that will trigger the function (insert, update)
Type = row level or statement level

26
Q

What is row level and statement level in reference to trigger type?

A

Row executes once for each record affected by the event (could be a lot)
Statement executes once regardless of records affected (only once)

27
Q

Packages have 2 parts:

A

specification and body

28
Q

I have a subprogram that is mentioned in the package body but not the specification, what does that mean?

A

It means the subprogram is PRIVATE

29
Q

What are the 4 advantages of packages?

A

Modularity, Encapsulation, Overloading, Performance