SQL (ingles)


Damian Types in SQL

Char(n) Fixed length charácter string



Small int

Numeric (p.d)

Real, doublé precisión

Float (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”


From loan

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

From loan

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

Select loan_number

From loan

Where brach_name=´perrydrige´

And amount>1200

Comparison results can be combined using the logical connectives and or,and not.


About lizgutierrezlpz5

hello!! my name is liz. I like to dance. My hobby is go to cinema. La vida es corta hay que disfrutar cada instante al 100!!
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s