Intermediate SQL¶
Join Expressions¶
Join Relations¶
- Join type:
- defines how tuples in each relation that do not match any tuple in the other relation (based on the join condition) are treated.
- join condition:
- defines which tuples in the two relations match, and what attributes are present in the result of the join.
Transactions¶
- commit work
- rollback work
Views¶
- to disguise certain daya from the view of certain users
- create view
then we can use it
views can be defined by other views
- updates of a view
- Most SQL implementations allow updates only on simple views
- materialized view
- create a physical table containing all the tuples in the result of the query defining the view
- index creation:
SQL | |
---|---|
Integrity Constraints¶
- not null
- primary key
- unique
form a candidate key, permit nulls, unlike primary key
- check(p)
where P is a predicate. Specifies a predicate P that must be satisfied by every tuple in a relation.
Referential Integrity¶
- cascade
- delete cascade: delete all tuples in the referencing relation
- update cascade: update all foreign keys in the referencing relation
Complex Check Clauses¶
- subquery in check clause not supported by pretty much any database
User-Defined Types¶
SQL | |
---|---|
- domains:
a type with constraints
SQL | |
---|---|
large-object types¶
Authorization¶
- grant:
Revoking Authorization¶
role¶
- a role is a way to distinguish among users as far as what these users can access/update in the database