- JDBC: Java Database Connectivity
- ODBC: Open Database Connectivity
- Embedded SQL
...
Embedded SQL
EXEC-SQL connect to server_addr user user_name using password;
EXEC SQL <embedded SQL statement > END_EXEC
EXEC SQL
declare c cursor for
select ID, name
from student
where tot_cred > :credit_amount
END_EXEC
Extensions and stored procedures
SQL provides a module language
Join operations take two relations and return as result another relation
A join operation is a Cartesian product which requires that tuples in the two relations match(under some condition). It also specifies the attributes that are present in the result of the join.
The ER data model employs three basic concepts: entity set, relationship set, attributes.
Entity sets:
An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant
An entity set is a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays.
- char(n): Fixed length character string, with user-specific length n.
- varchar(n): Variable length character strings, with user-specific maximum length n.
- int: Integer
- smallint: Small integer
- numeric(p, s): Fixed point number, with user-specific precision of p digits, with s digits to the right of decimal point.
- real, double precision: Floating point and double-precision floating point numbers
- float(n): Floating point number, with user-specific precision of at least n digits.
Create table
create table alluser (
id char(5),
name varchar(10) not null
)
Drop and alter
alter table alluser add email varchar(20)
Dropping of attributes not supported by many databases