Está en la página 1de 2

Crear tabla y primary key Crate table ( Campo_1 tipo (dimensin) not null, Campo_2 tipo (dimensin) not

null, Primary key (campo___) ) Agregar primary key alter table xx add primary key (yy) Agregar columna Alter table xx add column yy tipo (dimensin) not null Agregar foreign key Alter table xx add foreign key (yy) references xx (yy) Inserter datos Insert into xx (campo1, campo2, , campo_n) Values ( ____, ______ ) Insertar en corto insert into xx values ("___", "______") Actualizar update xx set yy= ____ where yyyyy= ___ Eliminar datos delete from xx where yy= ____ consultas sin criterios select yyn from xx consultas con criterios select yyn from xx where yy ="___" (notese que se puede usar and or not) Hacer consultas ascentes select yy from xx order by yy

consultar nico dato (criterio: minimo) select yy from x where y=(select min (y) from x) Consultar los n primeros datos que cumplen condicin (los de debajo de tabla o mayores) o bien decimos: los n mayores select top nn yy from xx order by yy desc Consultar los n primeros datos que cumplen condicin (los de arriba de tabla o menores) o bien decimos: los n menores select top nn yy from xx order by yy consulta ordenada de menor a mayor select poblacion from estado order by poblacion asc consultar datos distintos de un mismo campo select distinct yy from xx uso del where select campo_n from xx where campo R k and or not campo R p consultar todos los campos de la tabla select * from xx operadores aritmticos: divisin entera \ exponente ^ modulo mod

También podría gustarte