Beruflich Dokumente
Kultur Dokumente
QUERY
LANGUAGE (SQL)
Database Language
SQL
SQL
is an example of a transform-oriented
language, or language designed to use
relations to transform inputs into required
outputs
has 2 major components:
SQL
It
Free-format
SQL
SQL
Literals
Literals are
statements.
constants
used
in
SQL
10
Required data.
Domain constraints.
Entity integrity.
Referential integrity.
Enterprise constraints.
Required Data
position VARCHAR(10) NOT NULL
specify that column position cannot be null
Domain Constraints
(a) CHECK
sex
CHAR NOT NULL
CHECK (sex IN ('M', 'F'))
(b) CREATE DOMAIN
CREATE DOMAIN DomainName [AS] dataType
[DEFAULT defaultOption]
[CHECK (searchCondition)]
For example:
CREATE DOMAIN SexType AS CHAR
CHECK (VALUE IN ('M', 'F'));
sex
SexType
NOT NULL;
Domain Constraints
- SET NULL,
- NO ACTION
Data Definition
DROP SCHEMA
DROP DOMAIN
DROP TABLE
DROP VIEW
DROP INDEX
Data Definition
Views
View
Dynamic result of one or more relational
operations operating on base relations to
produce another relation.
Views
SELECT *
FROM Staff
WHERE branchNo = 'B003';
Advantages of Views
Data Independence
Currency
Improved Security
Reduced Complexity
Convenience
Customization
Data integrity
Disadvantages of Views
Update restriction
Structure restriction
Performance