#SQL - odpowiedzi do lekcji 1

Words
154
Reading
1 min
Listen
Play
8y

W dzisiejszy poranek napotem@napotem serwuje odpowiedzi do zapytań z wczorajszego wpisu. Schemat bazy danych również znajdziecie we wczorajszym wpisie. Zapraszam!

***

SELECT jedna tabela bez filtracji

--select ProductName, UnitPrice from Products;
--select ContactName, Address, City, PostalCode from Customers;
--select OrderID, OrderDate, RequiredDate, ShippedDate from Orders;
--select HomePage, * from Suppliers;

DISTINCT

--select * from EmployeeTerritories;
--select distinct EmployeeID from EmployeeTerritories;
--select distinct FirstName from Employees;
--select distinct City from Customers;
--select distinct ShipName, ShipCity from Orders;

AS

--select RegionID as nrid, RegionDescription as rd from Region;

ORDER BY

--select ProductName, UnitPrice from Products order by UnitPrice desc;
--select CompanyName from Customers;
--select EmployeeID, Region from Employees order by EmployeeID desc;
--select HireDate from Employees order by HireDate desc;
--select ProductID, UnitPrice, UnitsInStock from Products order by UnitsInStock, UnitPrice desc;

Obliczenia

--select ProductName, UnitPriceUnitsInStock from Products;
--select UnitsInStock-UnitsOnOrder as nie from Products order by nie asc;
--select ProductName, (UnitsInStock-UnitsOnOrder)
UnitPrice from Products;
--select from Products;

#SQL - odpowiedzi do lekcji 1 | Ecency