-All operations of a transaction must be completed
-If not, the transaction is aborted
Back
Command
§
Front
CREATE SCHEMA AUTHORIZATION {creator};
§
Seldom used directly
Back
Common SQL Data Types
Front
Numeric NUMBER(L,D) or NUMERIC(L,D)
Character CHAR(L) • VARCHAR(L) or VARCHAR2(L) •DATE Date
Back
Primary Key and Foreign Key
§
Front
Primary key attributes contain both a NOT NULL
and a UNIQUE specification
§
RDBMS will automatically enforce referential
integrity for foreign keys
§
Command sequence ends with semicolon
§
Back
DEFAULT
Front
Assigns value to attribute when a new row is added to table.
Back
ON Clause
Front
Performs the equality check for common columns of the two tables
Back
Problems in Concurrency Control
Front
-lost update
-uncommitted data
-inconsistent retrievals
Back
Authentication
Front
Process DBMS uses to verify that only registered users access the data. Required for the creation tables.
Back
Inconsistent retrievals
Front
-Occurs when a transaction accesses data before and after one or more other transactions finish working with such data
1. EX:
-First transaction accesses data
-Second transaction alters the data
-First transaction accesses the data again
2. Transaction might read some data before they are changed and other data after changed
3. Yields inconsistent results
Back
ANSI SQL
Front
Allows use of following clauses to cover CASCADE, SET NULL, or SET DEFAULT; ON DELETE and ON UPDATE.
Back
Categories of SQL function
§
Front
Data definition language (DDL)
§
Data manipulation language (DML)
§
Back
Numeric
Front
NUMBER (L,D) or NUMBERIC (L,D)
Back
Natural join (2)
Front
an equi-join in which one of the duplicate columns is eliminated in the result table
Only return records from each tables that have a match in the join condition with the other table
Back
Equi-join
Front
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
Back
Syntax to create table
§
Front
CREATE TABLE tablename();
Back
Transaction
Front
1. Logical unit of work that must be entirely completed or aborted
2. Consists of:
-SELECT statement
-Series of related UPDATE statements
-Series of INSERT statements
-Combination of SELECT, UPDATE, and INSERT statements
EX: Accounting
Back
Subquery example
Front
SELECT
FROM
WHERE .... IN
(SELECT DISTINCT CustomerID FROM Order_T)
*distinct operator ensures that it only appears one in the final result*
Back
Structured Query Language (SQL)
§
Front
Nonprocedural language with basic command vocabulary set of less than 100 words
§
Differences in SQL dialects are minor
Back
Transaction Log
Front
1. Keeps track of all transactions that update the database
2. DBMS uses the information stored in a log for:
-Recovery requirement triggered by a ROLLBACK statement
-A program's abnormal termination
-A system failure
Back
Serializability
Front
Ensures that the schedule for the concurrent execution of several transactions should yield consistent results
Back
Outer join
Front
a join in which rows that do not have matching values in common columns are nonetheless included in the result table
Back
Features of table creating command sequence
§
Front
NOT NULL specification
§
UNIQUE specification
§
Back
Creating Table Structures
§
Front
Use one line per column (attribute) definition
§
Use spaces to line up attribute characteristics and
constraints
§
Table and attribute names are capitalized
§
Back
Isolation
Front
Data used during transaction cannot be used by second transaction until the first is completed
Back
Joining vs. Subquery technique (2 each)
Front
Joining technique- useful when data from several relations are to be retrieved and displayed, and the relationships are not necessarily nested
* combines all rows from each table, then removes rows that dont match the conditions*
Subquery technique - allows you to display data from only the tables mentioned in the outer query.
*executes then returns a result and then the result is sent to the outer query*
Back
Lost update
Front
Occurs in two concurrent transactions when:
-Same data element is updated
-One of the updates is lost
Back
Self Join
Front
Usually used with unary relationships
Same tables is used on both sides of the join; distinguished using aliases
Back
The Database Schema
§
Front
Logical group of database objects related to each other
§
Back
Structures query language
Front
Categories: data definition, data manipulation.
Nonprocedural language with basic command vocabulary set of less than 100 words. Differences in SQL dialects are minor.
Back
Union join
Front
includes all data from each table that was joined
Back
Primary key
Front
Attributes contain both a NOT NULL and a UNIQUE specification.
Back
Consistency
Front
Permanence of database's consistent state
Back
Creating table structures
Front
Use one line per column definition. Spaces line up attribute characteristics and constraints. Names are capitalized. Features create command sequence. Syntax to create table.
Back
ANSI SQL allows use of following clauses to cover CASCADE, SET NULL, or SET DEFAULT
§
Front
ON DELETE and ON UPDATE
Back
Character
Front
CHAR (L), VARCHAR(L), VARCHAR2(L)
Back
Tasks to be completed before using a new RDBMS
Front
Create a new database structure; RDBMS creates physical files that will hold database; differed from one RDBMS to another.
Back
Durability
Front
Ensures that once transactions are committed, they cannot be undone or lost
Back
Concurrency Control
Front
-Coordination of the simultaneous transactions execution in a multiuser database system
-Objective - Ensures serializability of transactions in a multiuser database environment
Back
Tasks to be Completed Before Using a New RDBMS Create database structure
Front
RDBMS creates physical files that will hold database
§
Differs from one RDBMS to another
§
Back
Authentication
Front
Process DBMS uses to verify that
only registered users access the data
§
Required for the creation tables
§
User should log on to RDBMS using user ID and password created by database administrator
Back
Foreign key
Front
RDBMS will automatically enforce referential integrity foreign keys.
Back
Uncommitted data
Front
Occurs when:
-Two transactions are executed concurrently
-First transaction is rolled back after the second transaction has already accessed _______
Back
UNIQUE
Front
Ensures that all values in column are unique.
Back
Join
Front
a relational operation that causes two or more tables with a common domain to be combined into a single table or view
Back
NOT NULL
Front
Ensures that column does not accept nulls.
Back
Database schema
Front
Logical group of database objects related to each other. Command: CREATE SCHEMA AUTHORIZATION {creator};
Back
LEFT OUTER JOIN clause (2)
Front
Causes customer data to appear even if there is no corresponding order data
* will include customer rows with no matching order rows unlike inner join*
Back
§
Front
Back
Subquery (def + options3)
Front
Placing an inner query (SELECT statement) inside an outer query
Options:
In a condition of the WHERE clause
As a "table" of the FROM clause
Within the HAVING clause
Back
Inner Join Clause (2)
Front
Alternative to WHERE clause and is used to match the PK and FK
Only return rows from each table that have matching rows in the other
Back
Section 2
(50 cards)
Wildcard character (*)
Front
Substitute for other characters/command
Back
ROLLBACK: command to restore the database
Front
Syntax- ROLLBACK;
Undoes the changes since last COMMIT command
Back
Syntax to create SQL indexes
§
CREATE INDEX
Front
indexname ON tablename();
§
Back
UPDATE: command to modify data
Front
UPDATE table name SET column name=expression [column name=expression] [WHERE condition list];
Back
SQL Constraints
•
Front
Ensures that column does not accept nulls
NOT NULL
•
Ensures that all values in column are unique
UNIQUE
•
Assigns value to attribute when a new row is added to table
DEFAULT
•
Validates data when attribute value is entered
CHECK
Back
WHERE condition
Front
Specifies the rows to be selected
Back
INSERT: command to insert data into table
Front
Syntax- INSERT INTO table name VALUE();
Used to add table rows with NULL and NOT NULL attributes.
added statistical functions
new data types
XML processing capabilities
Back
Composite index:
§
Front
Is based on two or more attributes
§
Prevents data duplication
§
Back
Two-phase locking governing rules
Front
-Two transactions cannot have conflicting locks
-No unlock operation can precede a lock operation in the same transaction
-No data are affected until all locks are obtained
Back
Levels of locking
Front
1. Database-level lock
2. Table-level lock
3. Page-level lock
-Page or diskpage: Directly addressable section of a disk
4. Row-level lock
5. Field-level lock
-Look at slides #25-#28
Can be constructed using an expression that equates to a value or a predicate. Based on threevalue logic ( true, false, don't know)
NULLIF & COALESCE are the keywords for CASE expression
Back
Scheduler
Front
1. Establishes the order in which the operations are executed within concurrent transactions
-Interleaves the execution of database operations to ensure serializability and isolation of transactions
2. Based on concurrent control algorithms to determine the appropriate order
3. Creates serialization schedule
-Serializable schedule: Interleaved execution of transactions yields the same results as the serial execution of the transactions
Back
Deadlock
Front
Occurs when two transactions wait indefinitely for each other to unlock data
-Known as deadly embrace
Back
DELETE: Command to delete
•
Front
Syntax
-
DELETE FROM
tablename
•
[WHERE
conditionlist
];
Back
Inserting Table Rows with a
SELECT Subquery
Front
Used to add multiple rows using another table as source
§
Back
Functions
Front
routines that return values and take input parameters
called explicitly by user; return a value
Back
ROLLBACK: Command to restore the database
•
Front
Syntax
-
ROLLBACK;
•
Undoes the changes since last COMMIT
command
Back
Routines
Front
Program modules that execute on demand
Can be either procedures or functions
Back
Avoiding deadlocks
Front
1. Control techniques
-Deadlock prevention
-Deadlock detection
-Deadlock avoidance
2. Choice of deadlock control method depends on database environment
Back
CHECK
Front
Validates data when attributes value is entered.
Back
Two-phase locking phases
Front
1. Growing phase - Transaction acquires all required locks without unlocking any data
2. Shrinking phase - Transaction releases all locks and cannot obtain any new lock
Back
Data Manipulation Commands INSERT: Command to insert data into table
•
Front
Syntax
-
INSERT INTO
tablename
VALUES();
•
Used to add table rows with NULL and NOT NULL
attributes
Back
SELECT: Command to list the contents
•
Front
Syntax
-
SELECT
columnlist
FROM
tablename
;
•
Wildcard character
(*): Substitute for other
characters/command
Back
Transaction (4)
Front
A discrete unit of work that must be completely processed or not processed at all
-May involve multiple updates
-If any update fails, then all other updates must be cancelled
*Atomic; all complete or none of it*
Noncorrelated: - dont depend on data from outer query
- execute once for the entire outerquery
* inner query executes once then the outer query*
Correlated: - Use data from outer query - Execute once for each row in outerquery -can use EXISTS operator
*Reference to a table in the outerquery*
*Outerquery executes for each row of the outerquery; innerquery executes once*
Back
Union Queries (2)
Front
Combine the output (union of multiple queries) together into a single result table
*data types of the attributes in the SELECT clauses of both queries must be identical*
Back
Query efficiency considerations (3)
Front
1. Instead of SELECT *, identify the specific attributes in the SELECT clause -->this helps reduce network traffic of result set
2. Limit the number of subqueries; try to make everything done in a single query if possible
3. If data is to be used many times, make a separate query and store it as a view
Back
SQL Indexes
§
Front
When primary key is declared, DBMS automatically
creates unique index
§
Back
Procedures
Front
routines that do not return values and can take input or output parameters
called explicitly by user
Back
Syntax
§
Front
INSERT INTO
tablename
SELECT
columnlist
FROM
tablename
§
Back
Two-phase locking(2PL)
Front
1. Defines how transactions acquire and relinquish locks
2. Guarantees serializability but does not prevent deadlocks
Back
DROP INDEX
Front
Index name; syntax to delete an index.
Back
Guidelines for better Query design (7)
Front
1. Understand how indexes are used in query processing
2. Keep optimizer statistics up-to-date
3. Use compatible data types for fields and literals
4. Write simple queries
5. Break complex queries into multiple simple parts
6. Don't nest one query inside another query
7. Don't combine a query with itself
Back
SELECT: command to list the contents
Front
Syntax- SELECT columnist FROM table name;
Back
CREATE INDEX
Front
Index name ON table name (); syntax to create SQL indexes.
Back
SQL indexes
Front
When primary key is declared, DBMS automatically creates unique index.
Back
SQL commands for transactions (3)
Front
BEGIN TRANSACTION/END TRANSACTION
-Marks boundaries of a transaction
COMMIT
-Makes all updates permanent
ROLLBACK
-Cancels updates since the last COMMIT
Back
Syntax to delete an index
§
DROP INDEX
Front
indexname;
Back
WHERE condition
•
Front
Specifies the rows to be selected
Back
Composite index
Front
Based on two or more attributes, prevents data duplication.?
Back
Data Dictionary Facilities (3)
Front
System tables that store metadata
Users usually can view some of these tables
Users are restricted from updating them
Back
Triggers
Front
Routines that execute in response to a database event (INSERT, UPDATE, or DELETE)
Not called explicitly; event driven
Back
Lock manager
Front
Responsible for assigning and policing the locks used by the transactions
Back
SELECT subquery
Front
INSERT INTO table name SELECT column list FROM table name;
Used to add multiple rows using another table as source.
Back
DELETE: command to delete
Front
Syntax- DELETE FROM table name [WHERE conditionalist];
Back
Tips to develop queries (8)
Front
1. Be familiar with the data model (entities and relationships)
2. Understand the desired results
3. Know the attributes desired in results
4. Identify the entities that contain desired attributes
5. Review ERD
6. Construct a WHERE equality for each link
7. Fine tune with GROUP BY and HAVING clauses if needed
8. Consider the effect on unusual data
Back
Section 3
(50 cards)
Dynamic SQL
Front
Ability for an application program to generate SQL code on the fly, as the application is running
Back
The Rule of Precedence
Front
Establish the order in which computations are completed. Performs operations within parentheses, power operations, multiplications and divisions, additions and subtractions.
Back
Copying parts of tables
Front
SQL permits copying contents of selected table columns. Data need not be reentered manually into newly created tables. Rows are added to new table using rows from another table.
Back
Changing a column's data characteristics
Front
Use ALTER; changes in column's characteristics are permitted if changes do not alter the existing data type.
Syntax- ALTER TABLE table name MODIFY(column name(characteristic));
Back
Subquery
Front
Query embedded/nested inside another query.
Back
Comparison Operators: Computed
Columns and Column Aliases
§
Front
SQL accepts any valid expressions/formulas in the
computed columns
§
Computed column, an alias, and date arithmetic can
be used in a single query
Back
Embedded SQL
Front
Including hard-coded SQL statements in a program written in another language such as C or Java
Back
IN
Front
Checks whether attribute value matches any value within a value list
Back
The Rule of Precedence
Front
Establish the order in
which computations are completed
Back
Advanced data updates
Front
If a relationship is established between entries and existing columns, the relationship can assign values to appropriate slots. Arithmetic operators are useful.
Back
Copying Parts of Tables
§
Front
SQL permits copying contents of selected table
columns
§
Data need not be reentered manually into newly created
table(s)
§
Table structure is created
§
Rows are added to new table using rows from another
table
Back
Dropping a column
§
Front
Use ALTER and DROP
§
Some RDBMSs impose restrictions on the deletion of
an attribute
Back
EXISTS
Front
Checks if subquery returns any rows.
Back
Between
Front
Checks whether attribute value is within a range
Back
Adding a column
§
Front
Use ALTER and ADD
§
Do not include the NOT NULL clause for new
column
§
Back
Changing Column's Data Characteristics
§
Front
Use ALTER to change data characteristics
§
Changes in column's characteristics are permitted if
changes do not alter the existing data type
§
Syntax
§
ALTER TABLE
tablename
MODIFY
(columnname(characterstic))
;
Back
Joining Tables With an Alias
§
Front
Alias identifies the source table from which data are
taken
§
Any legal table name can be used as alias
§
Add alias after table name in FROM clause
§
FROM tablename alias
Back
Following syntax
enables to specify which rows to
select
Front
SELECT
columnlist
§
FROM
tablelist
§
[WHERE
conditionlist
];
Back
ALTER TABLE
Front
To make changes in the table structure; add, modify, drop. Used to add table constraints and remove table constraints.
Back
Deleting a Table
from the
Database
Front
Can drop a table only if it is not the one side of any
relationship
§
RDBMS generates a foreign key integrity violation
error message if the table is dropped
Back
Optional WHERE clause
Front
Adds conditional restrictions to the SELECT statement
Back
Ordering a Listing
§
Front
ORDER BY
clause is useful when listing order is
important
§
Syntax
-
SELECT
columnlist
FROM
tablelist
[WHERE
conditionlist
]
[ORDER BY
columnlist
[ASC | DESC]];
§
Cascading order sequence
: Multilevel ordered
sequence
§
Created by listing several attributes after the ORDER
BY clause
Back
Joining Database Tables
§
Front
Performed when data are retrieved from more than
one table at a time
§
Equality comparison between foreign key and primary
key of related tables
§
Tables are joined by listing tables in FROM clause of
SELECT statement
§
DBMS creates Cartesian product of every table in the
FROM clause
Back
Grouping Data
§
Front
Frequency distributions created by
GROUP BY
clause within SELECT statement
§
Syntax
-
SELECT
columnlist
FROM
tablelist
[WHERE
conditionlist
]
[GROUP BY
columnlist
]
[HAVING
conditionlist
]
[ORDER BY
columnlist
[ASC | DESC]];
Back
Alias
Front
Alternate name given to a column or table in any SQL statement to improve the readability. Computed column, can be used in a single query.
Back
Special Operators
Front
BETWEEN
•
Checks whether attribute value is within a range
IS NULL
•
Checks
whether attribute value is null
LIKE
•
Checks
whether attribute value matches given string pattern
IN
•
Checks
whether attribute value matches any value within a value list
EXISTS
•
Checks
if subquery returns any rows
Back
Listing Unique Values
§
Front
DISTINCT
clause: Produces list of values that are
unique
§
Syntax
-
SELECT DISTINCT
columnlist
FROM
tablelist
;
§
Access places nulls at the top of the list
§
Oracle places it at the bottom
§
Placement of nulls does not affect list contents
Back
Adding primary key and foreign key designations
Front
ALTER TABLE command followed by a keyword that produces
Back
ALTER TABLE command
§
Front
Followed by a keyword that
produces
the specific
change one wants to make
§
Options include ADD, MODIFY, and DROP
§
Back
HAVING Clause
§
Front
Extension of GROUP BY feature
§
Applied to output of GROUP BY operation
§
Used in conjunction with GROUP BY clause in
second SQL command set
§
Similar to WHERE clause in SELECT statement
Back
Comparison Operators
§
Front
Add conditional restrictions on selected table
contents
§
Used on:
§
Character attributes
§
Dates
Back
LIKE
Front
Checks whether attribute value matches given string pattern
Back
Arithmetic operators
§
Front
Perform:
§
Operations within parentheses
§
Power operations
§
Multiplications and divisions
§
Additions and subtractions
Back
Alias
Front
Alternate name given to a column or table in any SQL statement to improve the readability
Back
Selecting Rows Using Conditional
Restrictions
Front
Used to select partial table contents by placing
restrictions on the rows
§
Back
IS NULL
Front
Checks whether attribute value is null
Back
Subquery
Front
Query embedded/nested inside another
query
Back
Changing a column's data type
Front
Use ALTER; some RDBMSs do not permit changes to data types unless column is empty.
Syntax- ALTER TABLE table name MODIFY (column name(data type));
Back
Advanced Data Definition Commands
§
Front
Keywords use with the command
§
ADD
-
Adds a column
§
MODIFY
-
Changes column characteristics
§
DROP
-
Deletes a column
§
Used to:
§
Add table constraints
§
Remove table constraints
Back
Selecting rows using conditional restrictions
Front
SELECT column list
FROM table list
[WHERE condition list];
Used to select partial table contents by placing restrictions on the rows.
Back
Recursive Joins
§
Front
Recursive query
: Table is joined to itself using alias
§
Use aliases to differentiate the table from itself
Back
Additional SELECT Query Keywords
§
Front
Logical operators work well in the query
environment
§
SQL provides useful functions that:
§
Counts
§
Find minimum and maximum values
§
Calculate averages
§
SQL allows user to limit queries to entries:
§
Having no duplicates
§
Whose duplicates may be grouped
Back
SELECT command
Front
Acts as a subquery and is
executed first
Back
Adding Primary and Foreign Key
Designations
§
Front
Syntax to add or modify columns
§
ALTER TABLE
tablename
§
{ADD | MODIFY} (
columnname datatype
[ {ADD |
MODIFY}
columnname datatype
] ) ;
§
ALTER TABLE
tablename
§
ADD
constraint
[ ADD
constraint
] ;
Back
DROP TABLE
Front
Deletes table from database
§
Syntax
-
DROP TABLE
tablename
;
Back
Advanced Data Updates
§
Front
UPDATE command updates only data in existing
rows
§
If a relationship is established between entries and
existing columns, the relationship can assign values
to appropriate slots
§
Arithmetic operators are useful in data updates
§
In Oracle, ROLLBACK command undoes changes
made by last two UPDATE statements
Back
Changing Column's Data Type
§
Front
ALTER can be used to change data type
§
Some RDBMSs do not permit changes to data types
unless column is empty
§
Syntax
-
§
ALTER TABLE
tablename
MODIFY
(columnname(datatype))
;
Back
Optional WHERE clause
§
Front
Adds conditional restrictions to the SELECT statement
Back
ALTER TABLE
Front
command: To make changes in the
table structure
Back
Comparison operators
Front
Add conditional restrictions on selected table contents. Used on character attributes and dates.
Back
Section 4
(50 cards)
In Oracle, you can use the SQL*Plus command SHOW ERRORS to help you diagnose errors found in PL/SQL blocks.
T/F
Front
True
Back
Which statement describes a feature of Oracle sequences?
a. Oracle sequences are tied to columns and tables.
b. Oracle sequences generate a character string that can be assigned to tables.
c. An Oracle sequence uses the identity column property to automatically number rows.
d. Dropping a sequence does not delete values assigned to table attributes; it deletes only the sequence object from the database.
Front
d. Dropping a sequence does not delete values assigned to table attributes; it deletes only the sequence object from the database.
Back
Which SQL format would be best used for a small, numeric data type?
a. INTEGER
b. SMALLINT
c. NUMERIC(L,D)
d. CHAR(L)
Front
b. SMALLINT
Back
When a user issues the DELETE FROM tablename command without specifying a WHERE condition, _____.
a. no rows will be deleted
b. the first row will be deleted
c. the last row will be deleted
d. all rows will be deleted
Front
d. all rows will be deleted
Back
The _____ constraint assigns a value to an attribute when a new row is added to a table.
a. NOT NULL
b. CASCADE
c. UNIQUE
d. DEFAULT
Front
d. DEFAULT
Back
No matter what language you use, if it contains embedded SQL statements, it is called the _____ language.
a. base
b. static
c. host
d. view
Front
c. host
Back
In Oracle, _____ make(s) it possible to merge SQL and traditional programming constructs, such as variables, conditional processing (IF-THEN-ELSE), basic loops (FOR and WHILE loops,) and error trapping.
a. dynamic SQL
b. stored procedures
c. embedded SQL
d. Procedural Language SQL
Front
d. Procedural Language SQL
Back
To remedy the lack of procedural functionality in SQL, and to provide some standardization within the many vendor offerings, the SQL-99 standard defined the use of persistent stored modules.
T/F
Front
True
Back
The tables on which a view, or a virtual table derived from a SELECT query, are based are called _____ tables.
a. indexed
b. core
c. relation
d. base
Front
d. base
Back
The _____ command permanently saves all changes—such as rows added, attributes modified, and rows deleted—made to any table in the database.
a. COMMIT
b. SELECT
c. ROLLBACK
d. UPDATE
Front
a. COMMIT
Back
Triggers can only be used to update table values.
T/F
Front
False
Back
Using the _____ command, SQL indexes can be created on the basis of any selected attribute.
a. CREATE INDEX
b. UPDATE CASCADE
c. SELECT
d. VARCHAR
Front
a. CREATE INDEX
Back
The DECLARE section in the trigger is used to declare any variables used inside the trigger code.
T/F
Front
True
Back
When writing SQL table-creating command sequences, the entire table definition is enclosed in _____.
a. asterisks
b. commas
c. quotations
d. parentheses
Front
d. parentheses
Back
A statement-level trigger is assumed if a designer omits the FOR EACH ROW keywords.
T/F
Front
True
Back
The _____ specification creates an individual index on a respective attribute; use it to avoid having duplicated values in a column.
a. UNIQUE
b. NOT NULL
c. UPDATE
d. VARCHAR
Front
a. UNIQUE
Back
The _____ constraint is used to validate data when an attribute value is entered.
a. UNIQUE
b. CASCADE
c. CHECK
d. SET NULL
Front
c. CHECK
Back
A trigger is procedural SQL code that is automatically invoked by the RDBMS upon the occurrence of a given data manipulation event.
T/F
Front
True
Back
The Oracle equivalent to an MS Access AutoNumber is a(n) _____.
a. auto-number
b. sequence
c. TO_NUMBER function
d. trigger
Front
b. sequence
Back
Automating business procedures and automatically maintaining data integrity and consistency are trivial in a modern business environment.
T/F
Front
False
Back
The Oracle string concatenation function is _____.
a. CONCAT
b. +
c. ||
d. &&
Front
c. ||
Back
A(n) _____ cursor is automatically created in procedural SQL when the SQL statement returns only one value.
a. implicit
b. dynamic
c. explicit
d. static
Front
a. implicit
Back
A persistent stored module is stored and executed on the database client machine.
T/F
Front
False
Back
A sequence is not associated with a table and can be dropped from a database with a DROP SEQUENCE command.
T/F
Front
True
Back
Stored procedures must have at least one argument.
T/F
Front
False
Back
Every PL/SQL block must be given a name.
T/F
Front
False
Back
Just like database triggers, stored procedures are stored in the database
T/F
Front
True
Back
Words used by a system that cannot be used for any other purpose are called _____ words. For example, in Oracle SQL, the word INITIAL cannot be used to name tables or columns.
a. reserved
b. unique
c. null
d. character
Front
a. reserved
Back
The _____ command is used to restore the database to its previous condition.
a. ROWCOUNT
b. BACKUP
c. COMMIT
d. ROLLBACK
Front
d. ROLLBACK
Back
Which command would be used to delete the table row where the P_CODE is 'BRT-345'?
a.
DELETE FROM PRODUCT
WHERE P_CODE = 'BRT-345';
b.
REMOVE FROM PRODUCT
WHERE P_CODE = 'BRT-345';
c.
ERASE FROM PRODUCT
WHERE P_CODE = 'BRT-345';
d.
ROLLBACK FROM PRODUCT
WHERE P_CODE = 'BRT-345';
Front
a.
DELETE FROM PRODUCT
WHERE P_CODE = 'BRT-345';
Back
An explicit cursor must return two or more rows.
T/F
Front
False
Back
BEFORE means before the changes are made in memory but after the changes are permanently saved to disk.
T/F
Front
False
Back
In Oracle, _____ retrieves the current value of a sequence.
a. NEXTVAL
b. CURRVAL
c. VARCHAR
d. VARCHAR2
Front
b. CURRVAL
Back
When you create a new database, the RDBMS automatically creates the data _____ tables in which to store the metadata and creates a default database administrator.
a. index
b. chapter
c. dictionary
d. appendix
Front
c. dictionary
Back
MySQL allows multiple triggering conditions per trigger.
T/F
Front
False
Back
The CREATE TABLE command lets you define constraints when you use the CONSTRAINT keyword, known as a(n) _____ constraint.
a. column
b. table
c. index
d. cell
Front
b. table
Back
A row-level trigger is assumed if we omit the FOR EACH ROW keywords and a statement-level trigger required the use of the FOR EACH ROW keyword.
T/F
Front
False
Back
SQL supports the conditional execution of procedures (IF-THEN-ELSE statements) that are typically supported by a programming language.
T/F
Front
False
Back
A view is a virtual table based on a SELECT query.
T/F
Front
True
Back
The most useful feature of PL/SQL blocks is that they let a designer create code that can be named, stored, and executed by the DBMS.
T/F
Front
True
Back
The PL/SQL block starts with the _____ section.
a. IS
b. OPEN
c. DECLARE
d. BEGIN
Front
c. DECLARE
Back
A _____ is a block of code containing standard SQL statements and procedural extensions that is stored and executed at the DBMS server.
a. cursor-style process
b. statement-level trigger
c. base table
d. persistent storage module (PSM)
Front
d. persistent storage module (PSM)
Back
The _____ pseudo-column is used to select the next value from a sequence.
a. CURRVAL
b. NEXTVAL
c. NEXT
d. GET_NEXT
Front
b. NEXTVAL
Back
All changes in a table structure are made using the _____ TABLE command, followed by a keyword that produces the specific changes a user wants to make.
a. ALTER
b. COMMIT
c. UPDATE
d. ROLLBACK
Front
a. ALTER
Back
Oracle recommends _____ for creating audit logs.
a. triggers
b. stored procedures
c. stored functions
d. tables
Front
a. triggers
Back
One of the major advantages of stored procedures is that they can be used to encapsulate and represent business transactions.
T/F
Front
True
Back
_____ is a cursor attribute that returns TRUE if the last FETCH returned a row, and FALSE if not.
a. %ROWCOUNT
b. %NOTFOUND
c. %FOUND
d. %ISOPEN
Front
c. %FOUND
Back
SQL requires the use of the _____ command to enter data into a table.
a. INSERT
b. SELECT
c. COMMIT
d. NOT NULL
Front
a. INSERT
Back
A table can be deleted from the database by using the _____ TABLE command.
a. DROP
b. DELETE
c. MODIFY
d. ERASE
Front
a. DROP
Back
You cannot have an invalid entry in the foreign key column; at the same time, you cannot delete a vendor row as long as a product row references that vendor. This is known as _____.
a. batch updating
b. referential integrity
c. authentication
d. cross joining
Front
b. referential integrity
Back
Section 5
(20 cards)
To make the SQL code more _____, most SQL programmers use one line per column (attribute) definition.
Front
readable
Back
(n) _____ view is a view that can be used to update attributes in the base table(s) that are used in the view.
Front
updatable
Back
U.S. state abbreviations are always two characters, so _____(2) is a logical choice for the data type representing a state column.
Front
CHAR
Back
A row-level trigger requires use of the _____ keywords and is executed once for each row affected by the triggering statement.
Front
FOR EACH ROW
Back
A table can be deleted from the database by using the _____ command.
Front
DROP TABLE
Back
In an INSERT command, a user can indicate just the attributes that have required values by listing the _____ inside parentheses after the table name.
Front
names
Back
The SQL data type DATE stores date in the _____ date format.
Front
Julian
Back
In MS Access, a designer can use the _____ data type to define a column in his table that will be automatically populated with unique numeric values.
Front
AutoNumber
Back
Using Oracle _____, a designer can write a PL/SQL code block by enclosing the commands inside BEGIN and END clauses.
Front
SQL*Plus
Back
A(n) _____ is a logical group of database objects, such as tables and indexes, that are related to each other.
Front
schema
Back
If the NOT NULL and UNIQUE specifications are not supported when using a command sequence, use _____ without the specifications.
Front
PRIMARY KEY
Back
A common practice is to create a(n) _____ on any field that is used as a search key, in comparison operations in a conditional expression, or when a user wants to list rows in a specific order.
Front
index
Back
In a 1:M relationship, a user must always create the table for the "_____" side first.
Front
one
Back
_____ words are words used by SQL to perform specific functions.
Front
Reserved
Back
A(n) _____ routine pools multiple transactions into a single batch to update a master table field in a single operation.
Front
batch update
Back
To delete an index, one must use the _____ command.
Front
DROP INDEX
Back
_____ is the term used to describe an environment in which the SQL statement is not known in advance and is generated at run time.
Front
Dynamic SQL
Back
A(n) _____-length character data type, like VARCHAR, is typically specified with a maximum length.
Front
variable
Back
If a user adds a new column to a table that already has rows, the existing rows will default to a value of _____ for the new column.
Front
null
Back
_____ is the process the DBMS uses to verify that only registered users access the database.