napotem avatar

#SQL - odpowiedzi do lekcji 2

napotem

Published: 04 Feb 2019 › Updated: 04 Feb 2019#SQL - odpowiedzi do lekcji 2

#SQL - odpowiedzi do lekcji 2

Dzisiaj przedstawię Wam odpowiedzi do zapytań z wcześniejszego wpisu. Wszystkie zadania wykonywane są na bazie Northwnd, która dostępna jest w sieci.

*

Zapytanie SELECT z filtracją danych (klauzula WHERE)

--select UnitPrice, ProductName from Products where UnitsInStock >100;
--select ProductName from Products where Discontinued = 1;
--select EmployeeID from Employees where YEAR(BirthDate) < 1950;
--select LastName, BirthDate from Employees where TitleOfCourtesy not like 'Dr.';

Zapytania z operacjami logicznymi na warunkach (AND, OR, NOT)

--select CompanyName from Suppliers where Fax is not null;
--select CompanyName, Phone from Customers where Country like 'Poland' or Country like 'France';
--select ProductName, UnitPrice from Products where Discontinued=0 and UnitsInStock>UnitsOnOrder;
--select ProductName from Products where not UnitPrice > 20 and not UnitsInStock!=0;

Wybór wartości z przedziału (between... and...)

--select FirstName, LastName from Employees where MONTH(BirthDate) between 5 and 9;
--select OrderID from [Order Details] where Discount between 0.15 and 0.20;

Wybór wartości zawartej w zbiorze (in)

--select BirthDate from Employees where FirstName in('Nancy', 'Andrew', 'Janet');
--select CompanyName, Address from Customers where City in('Berno', 'Graz', 'Warszawa');
--select LastName, City from Employees where Country in('UK');

Leave #SQL - odpowiedzi do lekcji 2 to:

Written by

Software Engineer & Traveller & Wife

Read more #pl-programowanie posts


Best Posts From napotem

We have not curated any of napotem's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From napotem