#SQL - odpowiedzi do lekcji 1

in #pl-programowanie5 years ago

W dzisiejszy poranek @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;

Sort:  

Witaj, jestem botem patrolującym #pl-artykuly.
Twój post nie spełnia podstawowej reguły #pl-artykuly dotyczącej długości wpisu.
Wyedytuj go dopisując więcej treści lub usuń tag - dziękujemy!

Więcej o regulaminie możesz przeczytać w podanym linku.