#notes# database chapter 4

tricks I fall into in exercises :

4.1 It's better for a relation to have a primary key to avoid duplicates ...

4.11  with declaration   :  with   with_name(attri1, attri2, ..., attrin) as (...here fill query results...)

4.13  answer is very simple, append depth as the last && new attribute is ok .

technic 1 to express 'for all X, P(X)'  ->> 'not exist X such that not P(X)'.

Q1 difference between SQL && Embedded SQL(in C)?

1.use a declare cursor , result is not computed

2.use open && fetch to obtain result.

Q2 principle(or process) of fetching query result using Embedded SQL (in C)?

open -> while(have item) -> fetch -> next ->go to while.

not familiar:

Dynamic SQL, ODBC, JDBC, Metadata

sth. funny:

That is, we wish to find employees who are supervised directly by Jones, or who are supervised by someone

who is supervsed by Jones, or who are supervised by someone who is supervised by someone who is supervised Jones, and so on.

outline:

additional built-in data types:  date , time, timestamp

user-defined types : create type ... as exist type final

lob

catalog.schema.relation

integrity constraint

constraint : not null, unique...(candicate key), check(predicate)

原文地址:https://www.cnblogs.com/ramanujan/p/3403110.html