Docsity

Codigos SQL Server 2020, Apuntes de Derecho

Toggle sidebar
bg1
Ejercicios:
select Customers.CustomerID,
Customers.CompanyName,
Customers.Country,
Customers.Fax
from Customers
where fax is null
-----------------------------------------------------------------------------
-------
select Customers.CustomerID,
Customers.CompanyName,
Customers.Country,
Customers.Fax
from Customers
where country = 'brazil' or country = 'france'
-----------------------------------------------------------------------------
-------
select Customers.CustomerID, Customers.CompanyName, Customers.ContactName,
Customers.Country, Orders.OrderID, Orders.OrderDate
from Customers inner join Orders on Customers.CustomerID = Orders.CustomerID
where (((Customers.Country)='france' or (Customers.Country)='brazil')
and ((Orders.orderid)<10262))
order by Orders.OrderID
-----------------------------------------------------------------------------
-------
select Employees.EmployeeID, Employees.LastName, Employees.FirstName,
Orders.OrderID, Orders.OrderDate
from Employees inner join Orders on Employees.EmployeeID = Orders.EmployeeID
where Orders.OrderID < 10270
order by Orders.OrderID
-----------------------------------------------------------------------------
-------
select Categories.CategoryID, Categories.CategoryName, Products.ProductID,
Products.ProductName, Products.UnitPrice,Products.UnitsInStock
from Categories inner join Products on Categories.CategoryID =
Products.CategoryID
where Categories.CategoryName = 'Condiments'
--Otra forma
select Categories.CategoryID, Categories.CategoryName, Products.ProductID,
Products.ProductName, Products.UnitPrice,Products.UnitsInStock
from Categories inner join Products on Categories.CategoryID =
Products.CategoryID
where Categories.CategoryID = 2
-----------------------------------------------------------------------------
-------
pf2

Vista previa parcial del texto

¡Descarga Codigos SQL Server 2020 y más Apuntes en PDF de Derecho solo en Docsity!

Ejercicios: select Customers.CustomerID, Customers.CompanyName, Customers.Country, Customers.Fax from Customers where fax is null



select Customers.CustomerID, Customers.CompanyName, Customers.Country, Customers.Fax from Customers where country = 'brazil' or country = 'france'



select Customers.CustomerID, Customers.CompanyName, Customers.ContactName, Customers.Country, Orders.OrderID, Orders.OrderDate from Customers inner join Orders on Customers.CustomerID = Orders.CustomerID where (((Customers.Country)='france' or (Customers.Country)='brazil') and ((Orders.orderid)< 10262 )) order by Orders.OrderID



select Employees.EmployeeID, Employees.LastName, Employees.FirstName, Orders.OrderID, Orders.OrderDate from Employees inner join Orders on Employees.EmployeeID = Orders.EmployeeID where Orders.OrderID < 10270 order by Orders.OrderID



select Categories.CategoryID, Categories.CategoryName, Products.ProductID, Products.ProductName, Products.UnitPrice,Products.UnitsInStock from Categories inner join Products on Categories.CategoryID = Products.CategoryID where Categories.CategoryName = 'Condiments' --Otra forma select Categories.CategoryID, Categories.CategoryName, Products.ProductID, Products.ProductName, Products.UnitPrice,Products.UnitsInStock from Categories inner join Products on Categories.CategoryID = Products.CategoryID where Categories.CategoryID = 2



select EmployeeID, LastName, Title, BirthDate, floor(datediff(day, birthdate, getdate()) / 365 ) as edad from Employees



select EmployeeID, LastName, Title, HireDate, floor(datediff(day, HireDate, getdate()) / 365 ) as Tiemp_trabajo from Employees



select Categories.CategoryID, Categories.CategoryName, Products.ProductID, Products.ProductName, Products.QuantityPerUnit, Products.UnitPrice, [Order Details].OrderID, [Order Details].ProductID from Categories inner join (Products inner join [Order Details] on Products.ProductID = [Order Details].ProductID) on Categories.CategoryID = Products.CategoryID where [Order Details].OrderID = '10248'