Sunteți pe pagina 1din 2

select *from Products

insert into Products


(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInSto
ck,UnitsOnOrder,ReorderLevel,Discontinued)
values (78,'soup vinage',12,7,'500ml' ,25.54,100,10,0)
---------------------------------
select *from shippers
select *from Territories
select all *from region
select *from Products
select * from Customers
select *from Categories
select *from Region

select * from Employees


Select *from [Order Details]
Select *from Practice
Select *from Suppliers
---------------------------
update Categories set Picture= 'escritorio'
select * from Region
alter table region drop column distancia --eliminar columnas
alter table Region add costo int -- agregar columnas
update Region set costo = 12
update Region set costo = costo +5
update Region set costo = costo +15 where RegionDescription= 'xxxx'

alter table Region add fecha date


update Region set fecha= '17-02-2014' where RegionDescription='xxxx'
select TerritoryDescription, RegionID from Territories where RegionID= (select
RegionID from Region where RegionDescription= 'Western')
delete from Region where RegionID=6 --eliminar filas completas
select *from Categories order by CategoryName desc
select CategoryID as codigo, CategoryName as Nombre from Categories
select top 10 ProductID,ProductName from Products order by ProductName desc
select top 10 percent ProductID,ProductName from Products
select *from Customers where Region is null

select ProductName from Products where ProductName= 'Beverage '


select cat.CategoryName as Nombre ,cat.Description as caracterisitca ,
Pro.UnitPrice as precio
from Categories cat, Products Pro where cat.CategoryID=Pro.CategoryID
select *from Products order by ProductName asc
select '100*2' as ecuacion, (100*2) as resultado-- operadores aritmeticos

select * from Products where UnitPrice between 18 and 21


alter table Products add Inventario int
update Products set Inventario = (UnitPrice)*(UnitsInStock)
----------------------------------------------------------------
select getdate()
select datepart(month,GETDATE())
select DATENAME(day, getdate())
select day('2011/02/01')
------------------------------
alter table Products add CostoInventario int
update Products set CostoInventario = (UnitPrice)*(UnitsInStock)

select ProductName,AVG(UnitsInStock) as promedio from Products where


UnitPrice<40
group by ProductName
having AVG(UnitsInStock)>20

select ProductName, UnitsInStock from Products where ProductName='Chai'

select ProductName,Sum(UnitsInStock) as promedio from Products where


UnitPrice<40
group by ProductName
having SUM(UnitsInStock)>20

select *from Products


select * from Customers

select COUNT(ProductName) from products

select * from Products where ProductName like '%C%'

-------------------------------------------------
select *from Products
Select *from [Order Details]

select P.ProductName, O.UnitPrice from Products P inner join [Order Details] O


on P.ProductID=O.ProductID

select P.ProductName, O.UnitPrice from Products P, [Order Details] O


where P.ProductID=O.ProductID

S-ar putea să vă placă și