Your SlideShare is downloading. ×
Campos calculados ropmario orcoapaza
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Campos calculados ropmario orcoapaza

66
views

Published on


0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
66
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CAMPOS CALCULADOS CON FECHACREATE DATABASE ALUMNOSUSE ALUMNOSCREATE TABLE PERSONAL(COD_PER NVARCHAR (20) NOT NULL,NOM_PER NVARCHAR (50) NOT NULL,SEMESTRE_PER NVARCHAR (50)NOT NULL,CARRERA_PER NVARCHAR (50)NOT NULL,FECHA_PER smalldatetime NOT NULL)insert into PERSONAL(COD_PER,NOM_PER,SEMESTRE_PER,CARRERA_PER,FECHA_PER)values(001,MENDOZA ARLISS,IV,COMPUTACION,12/09/1970)insert into PERSONAL(COD_PER,NOM_PER,SEMESTRE_PER,CARRERA_PER,FECHA_PER)values(002,CONTRERAS MIGUEL,II,ADMINISTRACION,12/10/1991)insert into PERSONAL(COD_PER,NOM_PER,SEMESTRE_PER,CARRERA_PER,FECHA_PER)values(003,PAREDES JOSE,IV,COMPUTACION,5/08/1990)insert into PERSONAL(COD_PER,NOM_PER,SEMESTRE_PER,CARRERA_PER,FECHA_PER)values(004,ZEGARRA CARINA,II,ADMINISTRACION,20/12/2000)SELECT NOM_PER,FECHA_PER,YEAR(GETDATE())-YEAR (FECHA_PER) AS EDAD FROMPERSONALSELECT NOM_PER,STR(YEAR(GETDATE())-YEAR(FECHA_PER))+AÑOS AS EDAD FROMPERSONALROMARIO ORCOAPAZA QUISOCALA
  • 2. SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE FECHA_PER=20/12/2000SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE YEAR(FECHA_PER)=1990ROMARIO ORCOAPAZA QUISOCALA
  • 3. SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE MONTH(FECHA_PER)=12SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE DAY(FECHA_PER)=12 ANDMONTH(FECHA_PER)=9ROMARIO ORCOAPAZA QUISOCALA
  • 4. SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE MONTH(FECHA_PER)IN(20,12,2000)SELECT NOM_PER,FECHA_PER FROM PERSONAL WHERE MONTH(FECHA_PER)IN (12,5)ROMARIO ORCOAPAZA QUISOCALA
  • 5. Creamos base de datos tiendasCREATE DATABASE TiendaUSE Tiendacreate table articulo(cod_pro nvarchar(10)not null,nombre_pro nvarchar(20) not null,costo_pro numeric(18,0) not null,precio_pro numeric(18,0) not null,stock_pro smallint)select * from articuloROMARIO ORCOAPAZA QUISOCALA
  • 6. Calculamos un campo calculado:select stock_pro,costo_pro,stock_pro*costo_pro as valor_total fromarticuloselect nombre_pro,costo_pro,precio_pro,stock_pro,costo_pro*stock_pro asvalorizado from articuloROMARIO ORCOAPAZA QUISOCALA
  • 7. select nombre_pro,costo_pro,precio_pro,stock_pro,costo_pro*stock_pro asSVP from articuloselect nombre_pro,costo_pro,precio_pro,stock_pro,(precio_pro-costo_pro)*stock_pro as UTILIDADES from articuloROMARIO ORCOAPAZA QUISOCALA
  • 8. CAMPOS CALCULADOS CON VARIOS CAMPOS:select nombre_pro,costo_pro,precio_pro,stock_pro,costo_pro*stock_pro asSVC,precio_pro*stock_pro as SVP,(precio_pro-costo_pro)*stock_pro asUTILIDADES from articuloselect nombre_pro,precio_pro,(precio_pro*20)/100 AS DESCUENTO fromarticuloROMARIO ORCOAPAZA QUISOCALA
  • 9. select nombre_pro,precio_pro,precio_pro-(precio_pro*20)/100 AS PPUBLICOfrom articuloselect nombre_pro,precio_pro,(precio_pro*20)/100 AS DESCUENTO,precio_pro-(precio_pro*20/100)AS PPUBLICO from articuloROMARIO ORCOAPAZA QUISOCALA
  • 10. ROMARIO ORCOAPAZA QUISOCALA