Font size
WorksheetsADBMS
Total questions: 84
Worksheet time: 42mins
A programming language for storing and processing information in a relational database
SRL
SQL
RDBMS
DML
A database management system that manages data as a collection of tables in which all relationships are represented by common values in related tables.
MYSQL
RDBMS
SQL
XAMPP
SQL
Structured Queries Language
Standard Query Language
Structured Query Language
Standard Queries Language
RDBMS
Related Databases Management System
Relational Databases Management System
Related Database Management System
Relational Database Management Systems
Has benefits of a Reduced training costs
Standardized Relational Language
SQL Environment
SQL Standard
Data Definition Language
Specify syntax/semantics for data definition and manipulation.
Standardized Relational Language
SQL Environment
SQL Standard
Data Definition Language
Importance of SQL is not usually apparent to the application users.
Standardized Relational Language
SQL Environment
SQL Standard
Data Definition Language
These commands are used to create, alter, and drop tables, views and indexes. - It is also used to establish constraints in the database.
CREATE
DDL Data Definition Language
DROP
ALTER
Creates an object (a table, for example) in the database.
CREATE
DDL Data Definition Language
DROP
ALTER
Deletes an object in a database, usually irretrievably.
CREATE
DDL Data Definition Language
DROP
ALTER
Modifies the structure of an existing object in various ways. For example, adding a column in a existing table
CREATE
DDL Data Definition Language
DROP
ALTER
Commands used to maintain and query a database, including those for updating, inserting, modifying and querying data.
Data Types
Data Manipulation Language DML
NUMBER(L, D)
INTEGER
Data type selection is usually dictated by nature of data and by intended use.
Data Types
Data Manipulation Language DML
NUMBER(L, D)
INTEGER
The declaration (NUMBER 7, 2) indicates the numbers that will be stored with two decimal places may be up to six digits long, including the sign and decimal places. Examples are 12.32, -134.99.
Data Types
Data Manipulation Language DML
NUMBER(L, D)
INTEGER
May be abbreviated as INT. Integers are whole counting numbers, so they cannot be used if you want to store numbers with decimal places.
Data Types
Data Manipulation Language DML
NUMBER(L, D)
INTEGER
Like INTEGER but it is limited to integer values up to six(6) digits. If your integer values are relatively small, use SMALLINT instead of INT.
DECIMAL(L, D)
VARCHAR(L) or VARCHAR2(L)
SMALLINT
CHAR(L)
Like the NUMBER specification. DECIMAL(9,2), DECIMAL(9), and DECIMAL are all acceptable.
DECIMAL(L, D)
VARCHAR(L) or VARCHAR2(L)
SMALLINT
CHAR(L)
Fixed length character data up to 255 characters. If you store strings that are not as long as the CHAR parameter value, the remaining spaces are left unused
DECIMAL(L, D)
VARCHAR(L) or VARCHAR2(L)
SMALLINT
CHAR(L)
Variable-length character data. The designation _______(25) will let you store characters up to 25 characters long.
DECIMAL(L, D)
VARCHAR(L) or VARCHAR2(L)
SMALLINT
CHAR(L)
Stores dates (YYYY-MM-DD format).
DATE
Creating Table Structures
VARCHAR(L) or VARCHAR2(L)
CHAR(L)
Defines the ff. Use one line per column (attribute) definition. - Use spaces to line up attribute characteristics and constraints.
DATE
Creating Table Structures
VARCHAR(L) or VARCHAR2(L)
CHAR(L)
Adding Table Rows
UPDATE
SELECT
INSERT
COLUMN LIST
Listing Table Rows
UPDATE
SELECT
INSERT
COLUMN LIST
Updating Table Rows
UPDATE
SELECT
INSERT
COLUMN LIST
Deleting Table Rows
UPDATE
SELECT
INSERT
DELETE
a key which uniquely identifies each record in a table and it should not contain NULL values
FOREIGN KEY
PRIMARY KEY
a key used to link two tables together. It is a field in one table that refers to the PRIMARY KEY in another table.
FOREIGN KEY
PRIMARY KEY
Used to check whether attribute value is within range
IN
BETWEEN
IS NULL
LIKE
A Special Operator: that Used to check whether attribute value is null
IN
BETWEEN
IS NULL
LIKE
A Special Operator: that Used to check whether attribute value matches any value within a value list
IN
BETWEEN
IS NULL
LIKE
A Special Operator: that Used to check whether attribute value matches given string pattern
IN
BETWEEN
IS NULL
LIKE
Finds any values that starts with "a"
a%
%a
%or%
_r%
Finds any values that end with "a"
a%
%a
%or%
_r%
Finds any values that have with "or" in any position
a%
%a
%or%
_r%
Finds any values that have with "or" in any position
a%
%a
%or%
_r%
Finds any values that have with "or" in that second position
a%
%a
%or%
_r%
Finds any values that starts with 'a' and are at least 2 characters in length
'a_%'
'a%o'
'a__%'
'_r'
Finds any values that starts with 'a' and are at least 3 characters in length
'a_%'
'a%o'
'a__%'
'_r'
Finds any values that end with "a" and ends with "o"
'a%'
'%a'
'a%o'
'_r%'
All changes in table structure are made by using ALTER command, followed by keyword that produces specific change. The following three options are available: ADD, MODIFY, DROP
Advanced Database Management
Advanced DDL Command
Advanced Select Queries
ADVANCED SQL
SQL provides useful functions that can count, find minimum and maximum values, and calculate sum and average.
Advanced Database Management
Advanced DDL Command
Advanced Select Queries
ADVANCED SQL
Returns the number of rows with non-null values for a given column
SUM
MIN
COUNT
MAX
Returns the minimum value found in a given column
SUM
MIN
COUNT
MAX
Returns the minimum value found in a given column
SUM
MIN
COUNT
MAX
Returns the maximum value found in given column
SUM
MIN
COUNT
MAX
Returns the sum value of all values for a given column
SUM
MIN
COUNT
MAX
Returns the average of all values for a given column
SUM
MIN
AVG
MAX
A view is a virtual table based on SELECT query. It can contain columns, aliases and functions from one or more table
ADVANCED SQL
Restoring Table Contents
Saving Table Content
Creating a View
Changes made to table are not physically saved on disk until one of the following occurs: the database is closed, program is closed, or the COMMIT command is used.
ADVANCED SQL
Restoring Table Contents
Saving Table Content
Creating a View
The ROLLBACK command is used to restore database to its previous condition
ADVANCED SQL
Restoring Table Contents
Saving Table Content
Creating a View
A relational operation that causes two tables with a common domain to be combined into a single-table or view.
SQL Joins
Restoring Table Contents
Saving Table Content
Creating a View
Selects records that have matching values in both tables.
SQL Joins
Restoring Table Contents
INNER JOIN
Creating a View
SYNTAX:
SELECT columnname(s)
FROM tablename
LEFT JOIN tablename
ON tablename.columnname = tablename.columnname;
SQL Joins
LEFT JOIN
INNER JOIN
RIGHT JOIN
SYNTAX:
SELECT columnname(s)
FROM tablename
RIGHT JOIN tablename
ON tablename.columnname = tablename.columnname;
SQL Joins
LEFT JOIN
INNER JOIN
RIGHT JOIN
Operator used to combine the results of two or more SELECT statements.
TRANSACTION
UNION
INTERSECT
MINUS
A logical unit of work that must be either entirely completed or aborted.
TRANSACTION
UNION
INTERSECT
MINUS
A logical unit of work that must be either entirely completed or aborted.
TRANSACTION
UNION
INTERSECT
MINUS
All properties of a transaction must be completed.
ISOLATION
ATOMICITY
CONSISTENCY
DURABILITY
Permanence of database’s consistent state
ISOLATION
ATOMICITY
CONSISTENCY
DURABILITY
Data used during transaction cannot be used by second transaction until the first is completed.
ISOLATION
ATOMICITY
CONSISTENCY
DURABILITY
Once transaction are committed, they cannot be undone.
ISOLATION
ATOMICITY
CONSISTENCY
DURABILITY
Concurrent execution of several transaction yields consistent results.
ISOLATION
ATOMICITY
SERIALIZABILITY
DURABILITY
ANSI has defined standards that govern SQL transactions
Lost Updates
Transaction Management with SQL
Concurrency Control
The Transaction Log
it stores a record for the beginning of transaction.
Lost Updates
Transaction Management with SQL
Concurrency Control
The Transaction Log
Coordination of simultaneous transaction execution in multiprocessing database.
Lost Updates
Transaction Management with SQL
Concurrency Control
The Transaction Log
Problem that has Two concurrent transaction update same data element
Lost Updates
Transaction Management with SQL
Concurrency Control
The Transaction Log
First transaction rolled back after second already accessed uncommitted data.
Lost Updates
Inconsistent Retrievals
Uncommitted Data
The Scheduler
Transaction might read some data before they are changed and other data after changed
Lost Updates
Inconsistent Retrievals
Uncommitted Data
The Scheduler
Interleaves execution of database operations:
○ Ensures serializability.
○ Ensures isolation.
Lost Updates
Inconsistent Retrievals
Uncommitted Data
The Scheduler
It Guarantees exclusive use of a data item to a current transaction
Lock
Lock Manager
Lock Granularity
Responsible for assigning and policing the locks used by transactions.
Lock
Lock Manager
Lock Granularity
It Indicates level of lock use
Lock
Lock Manager
Lock Granularity
Entire database is locked.
Row-level lock
Table-level lock
Database-level lock
Page-level lock
Entire table is locked.
Row-level lock
Table-level lock
Database-level lock
Page-level lock
Entire disk page is locked.
Row-level lock
Table-level lock
Database-level lock
Page-level lock
Allows concurrent transaction to access different rows of same table.
Row-level lock
Table-level lock
Database-level lock
Page-level lock
Allows concurrent transaction the access same
Field-level lock
Table-level lock
Database-level lock
Page-level lock
Two states: locked (1) or unlocked (0).
Exclusive lock
Binary lock
Shared lock
Access is specifically reserved for transaction that locked object.
Exclusive lock
Binary lock
Shared lock
Access is specifically reserved for transaction that locked object.
Exclusive lock
Binary lock
Shared lock
Concurrent transactions are granted read access on basis of a common lock.
Exclusive lock
Binary lock
Shared lock
a Two Phase Locking that Transaction acquires all required locks without unlocking any data.
Glowing Phase
Shrinking Phase
Growing Phase
Arriving Phase
a Two Phase Locking that Transaction release all locks and cannot obtain any new lock.
Glowing Phase
Shrinking Phase
Growing Phase
Arriving Phase
Condition that occurs when two transactions wait for each other to unlock data.
Locks
Deadlocks
Lock Types
Lock Granularity
