Damian Types in SQL
Char(n) Fixed length charácter string
Real, doublé precisión
Basic Insertion and deletion of tuples
- Newly created table is empty
- Add a new tuple to account
Insert into account
Values (´A-97 32´, ‘peryndge’,1200)
- Insertion fails inf any integrity contra inti s violated
- Delete all tuples from account
Dealte from account
Not: Will later how to delate selected tuples.
Drop and alter table constructs
The droptable command deletes all information about the dropped relation from the database.
The alter table command is used to add attributes to an existing relation.
Alter table r add AD
Where A is the name at the attribute to be added to relation r and D is the damian of A
- All tuples in the relation are asigned null as the value for the new attribute.
The alter table coomand can also be used to drop attributes of relation:
Alter table r drop A
Where A is the name of an attribute of relation r
Dropping of attributes not supported by many databases
The select clause(count)
- An asteriskin the select clause denotes “all attributes”
The select clause can countain aritmetic expressions involving the operation,+,-,*.
And /, and operating on constents or atributes of tuples
Eg: select loan_number_branch_name, amount*100
The where clause
The where clause specifics conditions taht the resault must satisfy.
Corresponds to the selection predicate of the relational algebra.
To find all loan number for loans made at the perryridge brach with loan amounts greater tan $1200
Comparison results can be combined using the logical connectives and or,and not.